我正在使用 Sitecore 7.2 和博客 2.3。
我有一个包含几个条目的博客,这些帖子显示正常。我正在尝试创建一个继承“Entry”的自定义模板“CustomEntry”
我按照链接 https://github.com/WeTeam/WeBlog/wiki/Template-Settings 中的所有步骤操作.博客现在完全是空的。调试时,GetBlogEntries() 似乎是空的。我相信这是一个与索引相关的问题。有几件事我不清楚。
- 在为 Entry 创建新模板时,我明白我应该继承 Entry。我继承了 Entry 和 StandardTemplate,并将 Entry 排序在 Standard Template 之上。这是我应该做的吗?
- 在下面的代码中,什么应该是“”,应该是我正在使用的博客模板。在我的例子中是 CustomEntry?我知道该值应该是“CustomEntry”模板的 ID。
<locations hint="list:AddCrawler">
<master type="Sitecore.Modules.WeBlog.Search.Crawlers.DatabaseCrawler,Sitecore.Modules.WeBlog">
<include hint="list:IncludeTemplate" entryTemplate="$(EntryTemplateID)" commentTemplate="$(CommentTemplateID)">
<myEntry>{D5608C5D-45E4-43FA-B2E4-DCD9DDF3E5A1}</myEntry>
<myComment>{C85123CF-DA89-4C37-ACFA-4F8BA5157AC1}</myComment>
</include>
</master>
<web type="Sitecore.Modules.WeBlog.Search.Crawlers.DatabaseCrawler,Sitecore.Modules.WeBlog">
<include hint="list:IncludeTemplate" entryTemplate="$(EntryTemplateID)" commentTemplate="$(CommentTemplateID)">
<myEntry>{D5608C5D-45E4-43FA-B2E4-DCD9DDF3E5A1}</myEntry>
<myComment>{C85123CF-DA89-4C37-ACFA-4F8BA5157AC1}</myComment>
</include>
</web>
</locations>
最佳答案
是的,您应该创建 3 个模板,每个模板都继承自 BlogEntry、BlogCategory 或 BlogComment:
/sitecore/templates/Modules/WeBlog/BlogEntry /sitecore/templates/Modules/WeBlog/BlogCategory /sitecore/templates/Modules/WeBlog/BlogComment
代码段中列出的设置适用于您在主索引和 Web 索引上设置的搜索索引。
这些设置应该是从内置模板继承的新模板的模板 ID。标签“myEntry”或“myComment”的名称可以随意命名,并且只会从这些标签中读取 Guid。
<myEntry>{D5608C5D-45E4-43FA-B2E4-DCD9DDF3E5A1}</myEntry>
<myComment>{C85123CF-DA89-4C37-ACFA-4F8BA5157AC1}</myComment>
我会尝试重建名为 weBlog 的搜索索引,看看是否能解决问题。
您必须确保您发布的博客条目是基于您创建的新模板。
你可以使用 Luke - https://code.google.com/p/luke/检查 Sitecore 索引/data/indexes 以查看您是否在索引中获取博客项目。
关于sitecore - 微博为条目创建自己的模板,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29762517/