我試圖在this answer中實施解決方案,以便能夠限制WeBlog中標籤雲中顯示的標籤數量。另外,我從文檔中使用these instructions。如何在Sitecore中的WeBlog模塊中覆蓋ITagManager
我修改了WeBlog配置以指向我自己的自定義TagManager實現。
<setting name="WeBlog.Implementation.TagManager" value="My.Namespace.CustomTagManager"/>
如果我加載sitecore/admin/showconfig.aspx
我可以確認配置設置已經更新了新的價值。
我的CustomTagManager
目前是ITagManager
接口的裸機實現。
public class CustomTagManager : ITagManager
{
public string[] GetTagsByBlog(ID blogId)
{
throw new System.NotImplementedException();
}
public string[] GetTagsByBlog(Item blogItem)
{
throw new System.NotImplementedException();
}
public Dictionary<string, int> GetTagsByEntry(EntryItem entry)
{
throw new System.NotImplementedException();
}
public Dictionary<string, int> GetAllTags()
{
throw new System.NotImplementedException();
}
public Dictionary<string, int> GetAllTags(BlogHomeItem blog)
{
throw new System.NotImplementedException();
}
public Dictionary<string, int> SortByWeight(IEnumerable<string> tags)
{
throw new System.NotImplementedException();
}
}
我可以反映部署的DLL,看到這些更改是肯定做出的,但這些更改沒有影響。沒有任何例外被拋出,標籤雲繼續填充,就好像我根本沒有做任何改變。這就像配置文件的變化被完全忽略。
爲了編寫我自己的客戶TagManager類,還需要更改哪些內容?
我正在使用WeBlog 5.2和Sitecore 7.1。
您可以檢查是否有在日誌什麼?如果WeBlog無法創建在配置中定義的管理器,它會記錄異常:「無法創建類型」{0}「的實例爲類型」{1}「」 –
您能否將程序集添加到config <<設置名稱=「WeBlog.Implementation.TagManager」value =「My.Namespace.CustomTagManager,MyAssembly」/>'? –
Hi @MarekMusielak - 這是問題所在。我已經添加了包含程序集完全限定名的答案。 – psych