Pages

Friday, May 14, 2010

Site Map and Navigations - Working with Table of Contents WebPart - MOSS 2007

Hi Everybody,


One of my project requirements was to create sitemap page for the site.

To implement this kind of functionalities MOSS offers you one of great web part known as Table of Contents Webpart.

All you need to do is just configure webpart to get contents from the location and let this web part know that whether to show sites or pages or everything

You can read about configuring this webpart here and here

But problem with this web part is

When you try to use this web part with your Publishing Site and configure webpart to show pages then this web part shows pages from Site’s Pages Library but some extra links too!! Example: Documents, Lists, people and groups..etc and of course we don’t want to show these kinds of links when you are working with Public facing site

So to avoid this situation> all you need to do is just create a custom xsl style in LevelStyle.xsl and that’s it.. you are done

Some basics : table of Contents webpart uses some xsl files to present data

  • TableOfContentsMain.xsl
  • Header.xsl
  • LevelStyle.xsl
LevelStyle.xsl is used to present each item in Table of Contents WebPart

(You can find all these xsl files in Style Library of Site)

So what I have done in this xsl style is, checking url of links which webpart fetches and then compare this url with ‘Pages’ keyword , as all pages and sites will be of course having url containing ‘pages ‘word so only those can be allowed and rendered.

because all unwanted links like> Documents, Lists, people and groups were containing link with keyword ‘_layouts/’ so this filtering is done