EPiServer.Blog setup
<p>This post tries to pinpoint every aspect of the EPiServer.Blog setup. How do you add tags to the tags collection property on the blog item page, how does the tagcloud get updated, how does the blog item pages get created beneath correct date root pages? Use this when troubleshooting your blog setup.</p>
Blog pagetypes:
- Blog Comment
- Blog Item
- Blog list
- Blog personal start
- Blog team start
It is important to notice that these pagetype names are referenced in the episerver.blog configuration section.
Download the demo template package from EPiServer (witch includes the blog templates). Import the package with EPiServer development center.
In addition to these pagetypes, you need the EPiServer.Blog module and corresponding configuration in web.config, for the blog to work.
Module:
\bin\EPiSever.blog.dll
Included this assembly in your bin folder. (You'll find it in the bin folder of your Demo site, see download link above).
Configuration:
1. Register a new section in web.config:
<sectionGroup name="episerverModules">
<section name="episerver.Blog" type="EPiServer.Blog.ConfigurationHandler, EPiServer.Blog"/>
</sectionGroup>
Place it just above </configSections>
2. Add section:
<episerverModules>
<episerver.Blog>
<vppProviderName>SiteGlobalFiles</vppProviderName>
<itemPageTypeName>Blog item</itemPageTypeName>
<teamStartPageTypeName>Blog team start</teamStartPageTypeName>
<personalStartPageTypeName>Blog personal start</personalStartPageTypeName>
<listPageTypeName>Blog list</listPageTypeName>
</episerver.Blog>
</episerverModules>
Place just above </configuration> in web.config.
This section holds references to the pagetype names. Thus; do not change pagetype names without changing this section.
3. Add reference to the httpmodule that uses these settings. This module exist in EPiServer.Blog namespace, and is responsible for auto creation of date and tag root pages beneath Blog team start page and Blog personal start page. It creates new tag pages and/or updates existing, when new blogs are posted. The admin job Update tag statistics are also part of this module.
<httpModules>
<add name="BlogHandler" type="EPiServer.Blog.EventHandlers, EPiServer.Blog"/>
...
</httpModules>
Code files
When You imported the package with EPiServer Development center the following files where added to your project:
\Templates\Pages\Blog\Item.aspx
\Templates\Pages\Blog\List.aspx
\Templates\Pages\Blog\PersonalStart.aspx
\Templates\Pages\Blog\TeamStart.aspx
(and code behind files)
\Templates\Blog\..
\Templates\Blog\Captcha\..
Templates\Blog\PropertyControls\..
Add these files to your project (DemoProject) and compile your solution.
Usage
Now everything is ready for you to create your first blog post. Start by creating a Blog team start page. Two child pages, Tags and Dates, will be created automatically (if the httpmodule is registered correctly). A dynamic property 'BlogStart' will be auto set on the Blog team start page as well. Some page properties, like DateContainer and TagContainer, are set as not visible in edit mode, and only used in code. This aplies to pagetype Blog personal page as well. This is the only pagetype that is allowed to be created beneath Blog team start page. The httpmodule will also create two child pages beneath this Blog personal start page as it is created. Finally it is time to post a blog item. This is done beneath the Blog personal page. The Blog item page will be create beneath a auto created date container, so the editor will always create a new blog post by right clicking on the personal start page, without needing to think about where to put it in the date structure.
Tags
You have two possible ways to add tags to your blog item. Either write a new tag in the "Selected tags" textbox (seperate multiple tags with comma), or use an existing tag from the "Existing tags" listbox. If you add a new tag, there will be created a new Tag (of pagetype Blog list) beneath the Tag container for your personal start page.
Technically these tags are also created as categories in EPiServer. All tags become subcategories of the BlogRoot category.
When blogers add tags to their posts, the tag cloud that is visible on every blog pagetype (tagcloud.ascx) might not be updated as you expect. A scheduled job 'Update tag statistics' updates how many times a tag is used in the team blog, so remember to activate this job. The tag cloud changes its visual presentation based on this statistics.