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