Search code examples
sitecoresitecore7.2weblog

WeBlog creating own template for Entry


I am using Sitecore 7.2 and weblog 2.3.

I have a blog with couple of Entries, the posts show up fine. I am trying to create a Custom Template "CustomEntry" that inherits "Entry"

I followed all the steps from the link https://github.com/WeTeam/WeBlog/wiki/Template-Settings. The Blog is now completely empty. While debugging, it appears that GetBlogEntries() is empty. I believe this is an Index related issue. There are couple of things unclear to me.

  1. When creating a new template for Entry, I understand that I should inherit Entry. I have inherited both Entry and StandardTemplate and sorted the Entry to be above the Standard Template. Is this what I am supposed to do?
  2. In the following code, what should be "", Should it be the Blog template that I am using. in my case CustomEntry? I understand that the value should be the ID for "CustomEntry" Template.
<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>

Solution

  • Yes, you should create 3 templates each one will inherit from either BlogEntry, BlogCategory or BlogComment:

    /sitecore/templates/Modules/WeBlog/BlogEntry /sitecore/templates/Modules/WeBlog/BlogCategory /sitecore/templates/Modules/WeBlog/BlogComment

    The settings listed in the snippet are for the search index which you have setup on the master and web indexes.

    These settings should be the template IDs of your new templates that inherit from the builtin templates. The names of the tags "myEntry" or "myComment" can be called whatever you like and only the Guid will be read from these tags.

    <myEntry>{D5608C5D-45E4-43FA-B2E4-DCD9DDF3E5A1}</myEntry>
    <myComment>{C85123CF-DA89-4C37-ACFA-4F8BA5157AC1}</myComment>
    

    I would try rebuilding the search index called weBlog to see if this fixes the issue.

    You have to make sure that you have blog entries published that are based on the new templates you have created.

    You could use Luke -https://code.google.com/p/luke/ to examine the Sitecore indexes /data/indexes to see if you are getting blog items in your index.