Skip to main content

Cloud

Breadcrumbs & Custom pages

Whenever we need to write an aspx page that needs to be invoked in the context of a sharepoint site, we can put them in the ‘_layouts’ virtual.To make the page look like the other sharepoint ‘_layouts’ pages (e.g. Site Settings etc), our custom aspx page will need to use the master page just like the other pages. The master page that we need is "application.master" which is defined as the aspx page attribute MasterPageFile="~/_layouts/application.master" and exists in the ‘layouts’ directory. Since in this post, we are focusing on the breadcrumb show up for our page, let’s take a look at how that works. The application.master page actually contains the breadcrumb control defined in it’s body as:

<asp:SiteMapPath SiteMapProvider="SPXmlContentMapProvider" id="ContentMap" SkipLinkText="" runat="server"/>

When you look at the above, it indicates that it uses the ASP.NET 2.0 provider mechanism (specifically the sitemap provider) to create the breadcrumb. It also suggests the type (XML) of storage that this provider probably uses. The XML file we are looking for is in the "C:InetpubwwwrootwssVirtualDirectories<site dir>_app_bin" directory. The file ‘layouts.sitemap’ which resides in this directory contains the breadcrumb information we need for the files in the layouts directory.

The file consists of a hierarchical structure made up of ‘sitemapnode’ XML nodes. A typical sitemapnode node looks like this:

<siteMapNode title="<custom breadcrumb name>" url="/_layouts/<aspxfilename>" />

All we need to do now is to add our own ‘sitemapnode’ in the spot we need in the hierarchy. Next time you hit your page, you should see the breadcrumb show up.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

PointBridge Blogs

More from this Author

Follow Us