Portal Engine Questions on portal engine and web parts.
Version 7.x > Portal Engine > Blog month not created when inheriting doctype View modes: 
User avatar
Member
Member
Boolean - 5/22/2013 9:51:10 AM
   
Blog month not created when inheriting doctype
I'd like to setup a blog on my site, but as there will be some heavy customization I did not want to affect the base "CMS.Blog", "CMS.BlogMonth" and "CMS.BlogPost" doctypes. The big issue this has caused in the past is that, by defining my own "MySite.Blog" etc. I can recreate all the functionality just fine except for the auto-creation of the blog post month.

When creating a new blog post, Kentico will look to see if the matching "CMS.BlogMonth" exists, and if it does not, creates the month node. It seems though that the logic is hardcoded to only look at "CMS.BlogPost", so even if I inherit that doctype Kentico doesn't create the month folder.

With the new doctype inheritance functionality in Kentico 7, is there a way to get this to work? It creates some rather major issues when you need to customize the CMS.Blog doctype for one site, but don't want to modify it for others.

Any ideas?

User avatar
Kentico Support
Kentico Support
kentico_filipl - 5/27/2013 1:44:02 AM
   
RE:Blog month not created when inheriting doctype
Hello,

There is a special method in CMS.DocumentEngine.DocumentHelper class to ensure that the parent document of a blog post is a blog month. It has the following declaration:
public static int EnsureBlogPostHierarchy(TreeNode blogPostNode, TreeNode currentParentNode, TreeProvider tree)

where

blogPostNode (TreeNode) - Blog post document
currentParentNode (TreeNode) - current parent document
tree (TreeProvider) - TreeProvider to use

It returns ID of the new parent (blog month document).

Best regards,
Filip Ligac

User avatar
Member
Member
beau.cowan-rrpartners - 9/18/2013 8:27:34 PM
   
RE:Blog month not created when inheriting doctype
So, how would you get it to go just to a Blog and not a BlogMonth? We are looking to add this feature to a new project for our client. They do not want the BlogMonth to be created when adding in a new BlogPost, and I am unable to find the feature that turns this off, or which file I would need to alter in order for this to happen.

User avatar
Kentico Support
Kentico Support
kentico_filipl - 9/20/2013 1:27:56 AM
   
RE:Blog month not created when inheriting doctype
Hello Beau,

You just need to clone the original Blog and Blog post document types and then it should be working. You can do that in Site Manager -> Development -> Document types -> <Blog/Blog post> -> Clone. Then if you create a blog and a blog post of these cloned document types, it will not automatically create Blog month.

Best regards,
Filip Ligac

User avatar
Member
Member
dan.mckenzie-forumcu - 12/20/2013 2:24:41 PM
   
RE:Blog month not created when inheriting doctype
I have the opposite issue - i cloned the default blog, blogmonth, and blogpost. Since doing so, blogmonth is NOT being created when I create a blogpost - thus, archiving is not working either. I confirmed that I have the appropriate child/parent types for each doctype cloned. Any advice? Thanks!

User avatar
Kentico Support
Kentico Support
kentico_jurajo - 12/22/2013 3:14:51 AM
   
RE:Blog month not created when inheriting doctype
Hello,

You need to ensure this on your own using custom event handler. We do not know how you will name your custom document type, even cloned so this is up to you. The default functionality is bound to the "cms.blogpost" and "cms.blogmonth" code names.

How to handle document events is described here. You can use e.g. the insert before event and create the month document.

Best regards,
Juraj Ondrus