Skip navigation.

1.x To 2.0 Migration Tip: Temporarily Disable Batch CompilationAll recent postsNew Font On the Block

Initialize Page Titles from Site Map (Part 2)

Bryant Likes and Kent Boogaart offered great suggestions in response to a previous post on this subject. Their suggestion was to create an HttpModule to set page titles from a site map.

Kent also suggests this approach to add meta tags, such as keywords. This offers some interesting opportunities. You can give a <siteMapNode> element arbitrary attributes and have them picked up by your HttpModule.

For example, the following node has a keywords attribute:

<siteMapNode 
    url="page1.aspx" title="Test" description="This is a test" 
    keywords="Keywords go here" />

The sample HttpModule, I put together per Kent’s suggestion, looks for this attribute on SiteMap.CurrentNode and adds a meta tag in the page head. You can add any other meta information or links this way. The only limit here is imagination.

Big thanks to Scott Allen for inspiring these ideas through his recent article Master Pages: Tips, Tricks, and Traps.

Comments

Comment permalink 1 Jørn Schou-Rode |
Hey - this makes sense! Usually I have a ContentPlaceHolder in the area of my MasterPage, used for meta data and alike. Let's collect all the meta data in the sitemap instead :)

Emails and Notifications

Would you like to be notified when somebody responds to this post?  Would you like to have these comments emailed to you?

TrackBacks

Sorry, TrackBacks are not allowed.

Submit your comment

Please enter only text since all HTML tags except hyperlinks will be stripped. Hyperlinks will become live links. Any comments with flaming or offensive language will be deleted. Be courteous to other posters. Thank you.

Your name (required):
Your email (optional):
Your site's URL (optional):
Enter this number
Type in the number above:
Comment (required):