sitecore - 微博为条目创建自己的模板

标签 sitecore sitecore7.2 weblog

我正在使用 Sitecore 7.2 和博客 2.3。

我有一个包含几个条目的博客,这些帖子显示正常。我正在尝试创建一个继承“Entry”的自定义模板“CustomEntry”

我按照链接 https://github.com/WeTeam/WeBlog/wiki/Template-Settings 中的所有步骤操作.博客现在完全是空的。调试时,GetBlogEntries() 似乎是空的。我相信这是一个与索引相关的问题。有几件事我不清楚。

  1. 在为 Entry 创建新模板时,我明白我应该继承 Entry。我继承了 Entry 和 StandardTemplate,并将 Entry 排序在 Standard Template 之上。这是我应该做的吗?
  2. 在下面的代码中,什么应该是“”,应该是我正在使用的博客模板。在我的例子中是 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/

相关文章:

java - 无法解决这些错误 Java (Pig UDF) 添加库,org.apache

package - 通过Sitecore TDS创建增量包

sitecore - 我如何将 Sitecore 项目按其创建日期以外的其他时间存储?

javascript - Sitecore 7.2 在添加到组件区域时在组件上触发 JavaScript

sitecore - 页面渲染后,为每个带有外部链接的 <a> 标签添加 nofollow 属性

Sitecore - 如果占位符为空则隐藏渲染

sitecore - 获取其他语言的字段值?

c# - 如何获取渲染用户控制路径,即使用渲染 ID 的 Ascx 文件

java - @Rolesallowed 是如何工作的