Wednesday, June 25, 2008

Adding Custom Styles to a Sitemap File

SharePoint has an excellent navigation mechanism that is provided by sitemap files. These files end in .sitemap and are XML files that define the structure of your site. The sitemap files contain a sitemap node that has one or more sitemapnode nodes inside it. In each of these you can give a title for the navigation item and the URL that the item should be a link to.



While SharePoint provides this nice navigation, it becomes a little tricky if you have a client that has specific needs for the fonts and colors of the navigation items. One of our clients navigation menus contains items that are one color on the first word or two of the item and a different color for the rest of the item. There was no easy way for me to modify these items to get more than one color to show up.



The answer came in the form of an HTML-XML hack. (I say hack in the nicest way possible on this one.) I simply inserted encoded HTML tags around the words or phrases that needed to be a different color. You need to encode the opening and closing brackets on the tags. This solution worked well to provide the custom navigation look that we needed for our client. As a side note, sitemap files will not allow a non-breaking space in them. If you add one (even encoded) it will throw an error telling you that a non-breaking space is not allowed.

Labels: , ,

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home