July 2010 » Rocking the Google Site Map Feature of Kentico CMS
Jul 12

Rocking the Google Site Map Feature of Kentico CMS

I’ve been pretty surprised at the traffic, mention, and email feedback that my last post, 7 Things you might want to check after launching a new Kentico CMS website, has received. In fact I was presented with a very good question in my inbox today about a detail from the fourth item in that list.

Pretty much the question boiled down to, why after submitting the Google site map URL to Google’s Webmaster tools, was the specified website’s pages not showing up in the resulting index or when viewed at the sites ~/CMSPages/GoogleSiteMap.aspx page.

Since the question came in from a friend, I decided to dig deeper and lend a hand. As soon as I logged into the site’s CMSDesk I quickly noticed what was up. Most of the content pages were using Custom Document Types. I was actually impressed to see this because it is sort of an advanced feature to use inside Kentico and normally an under utilized feature as well.

The output of the GoogleSiteMap.aspx page looked something like this, only the normal Menu Items from the CMS Tree:

 

Kentico CMS Google Site Map default

 

So after some quick research I found the devnet article on how to integrate the Googe site map feature. After reading the second paragraph of that article I knew exactly what was up. Turns out that by default the Google site map feature from Kentico only includes the “Page (menu) item” Document Types. This makes sense for someone that doesn’t have a lot of custom Document Types or dynamic content.

However, if you use custom Document Types, and you should, they rock, then you need to pop open your favorite text editor and add a very small amount of code to make the custom pages show up. Open up ~/CMSPages/GoogleSiteMap.aspx. The server tag in question that we are looking to change is the <cms:GoogleSiteMap> tag.

Default:

 

<cms:GoogleSitemap runat="server" ID="googleSitemap" TransformationName="CMS.Root.GoogleSiteMap" CacheMinutes="0" OrderBy="NodeLevel, NodeOrder, NodeName" /> 

 

Now what we need to do is add in whatever custom Document Types that we have, into a ClassNames property, chances are it is not there already. Let's use BizStream.TeamLeaderProfile in this example.

Change To:

 

<cms:GoogleSitemap run at="server" ID="googleSitemap" TransformationName="CMS.Root.GoogleSiteMap" CacheMinutes="30" OrderBy="NodeLevel, NodeOrder, NodeName" MaxRelativeLevel="-1" ClassNames="CMS.MenuItem;BizStream.TeamLeaderProfile" />

 

Don't forget that the property can accept multiple custom Document Types delimited by a semi-colon. Now save the page and you are all set. All of your pages should show up at the GoogleSiteMap.aspx url. Go ahead and browse to it to check it out.

You should now see the extra URLs part of the page output like:

 

Kentico CMS Google Site Map with Custom Document Type

 

I’d also like to point out that the default control does not look to be using the Cache system provided Kentico, CacheMinutes=0. I would recommend upping this value from 0 to at least 30 minutes if not more. There is a small chance that 0 could mean inherit from the top level tree or site, but I haven’t been able to verify this or not.

Note: if your curious about what kinds of pages that a custom Document Type can generate, check out the About page over at BizStream.com. That’s one example of how BizStream uses custom Document Types.

One last tip, like the devnet article mentions you don’t have to use that path to submit to Webmaster tools with, it is kind of long. You can change it to whatever you want by going to CMSSiteManager -> Settings -> (global) in list -> URLs -> Google sitemap URL.

I hope you enjoyed this small article about using the Google site map feature of Kentico CMS. As always leave feedback and opinions in the comments or send them to me email.

You might also be interested in

[X]

Be the first to know about my latest Kentico Tips & Tricks!

Do not show again