News blog post to be added to sitemap automatically

Feb 20, 2011 at 1:33 PM

Hi all,

I'm learning C1 and I think it is a great CMS. 

My understanding is that the Blog module will not add URL to the sitemap. Compared to other CMS, it will leads us to disadvantages in term of SEO. Is there any plan to add this functionality?




Feb 20, 2011 at 5:30 PM
Edited Feb 20, 2011 at 5:32 PM

Since the SitemapNavigator simply reflects over IPageStructure and IPage its not dynamic in any way, and can only know about "real" pages, and not extra data elements. All ChildPages properties only return IEnumerables as well so its not possible to add anything to them.

Using the SiteMapProvider from its possible to dynamically add new nodes to a node object, lets say

var blogPage = SiteMap.Provider.FindSiteMapNodeFromKey(some_guid);
foreach (var blogPost in data.GetBlogPosts)
   var blogPostNode = new SiteMapNode(SiteMap.Provider, blogPost.ID, blogPage.Url +"?id="+ blogPost.ID, blogPost.Title);

   blogPage.ReadOnly = false;
   blogPage.ReadOnly = true;

This would easiest be done by subclassing CompositeSiteMapProvider and overriding LoadSiteMapInternal to do this special blog-post logic after calling base.LoadSiteMapInternal, to make sure we have all these extra nodes each time the sitemap is being flushed or needs reloading.