Controlling navigation options from the onet.xml

During past weeks I have been creating few customer POCs to demostrate the excellent WCM features of the MOSS 2007. Since the MOSS publishing features are deployed over the WSS using standard feature framework, we can configure the provisioning of the sites directly from the onet.xml. In this blog entry, I'll declare the concepts behind this possibility and the possible properties, which can be set.



If you have played around the onet.xml files included as out-of-the-box in the MOSS (Publishing template etc.), you have most likely noticed the publishing navigation feature dependencies in the WebFeatures element as in xml block below.

     <Feature ID="541F5F57-C847-4e16-B59A-B31E90E6F9EA">
          <Properties xmlns="">
          <Property Key="InheritGlobalNavigation" Value="true"/>
          <Property Key="ShowSiblings" Value="true"/>
          <Property Key="IncludeSubSites" Value="true"/>

So what does this really mean? Basically we are making a binding to publishing navigation feature and configuring it by using properties, which the handler is capable to handle. So the ID given in the onet.xml is a reference to NavigationProperties feature, which can be found from the following folder (by default):

C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\FEATURES\NavigationProperties

And the feature.xml file from here contains following information:

<Feature Id="541F5F57-C847-4e16-B59A-B31E90E6F9EA"
               Title="Portal Navigation Properties"
               Description="Set per-site navigation properties."
               ReceiverAssembly="Microsoft.SharePoint.Publishing, Version=, Culture=neutral, PublicKeyToken=71e9bce111e9429c"
                    <ElementManifest Location="NavigationSiteSettings.xml"/>

As you can see, ReceiveAssebly and ReceiverClass attributes are set and there for when the actions are performed for the feature, "custom code" is executed. As declared already above, the custom code is aware of some parameters which can be set for the feature and based on these parameters, the receiver handler modifies the SPPublishingWeb object's properties.


Supported parameters

So what are the parameters supported by the NavigationFeatureHandler class and how do they affect compared to settings done from the user interface. I'll declare the supported parameters one-by-one and compare the settings to modifications done from the user interface (Site Actions -> Site Settings -> Navigation).


IncludeInGlobalNavigation, IncludeInCurrentNavigation 

Controls the IncludeInGlobalNavigation and IncludeInCurrentNavigation properties of the SPPublishingWeb. In user interface this functionality is controlled by using following options.



This paremeters controls the global navigation options. If set the true, we will get the same outcome by selecting "Display the same navigation items as the parent site".



This controls the inheritance of the current navigation. If set the true, we would get the same results as by selecting the "Display the same navigation items as the parent site" from the user interface (the first option from the picture below)




If set the TRUE, the outcome is the same options as the “Display the current site, the navigation items below the current site, and the current site's siblings” option in the user interface (second option from the picture below). Note that the IncludeSubSites and IncludePages parameters also affects to outcome.



This is same as the "Show subsites" option in the user interface. Note that if the current navigation has been set to show the same navigation items as the parent site, this option has no meaning.



This is same as the "Show subsites" option in the user interface. Note that if the current navigation has been set to show the same navigation items as the parent site, this option has no meaning.



This option affects to ordering of the navigation items. Note that the final outcome depends also from the AutomaticSortingMathod and the SortAscending properties.

Possible values

Automatic - Sort all node types automatically, and group pages after other types. 

Manual - Sort all types manually. 

ManualWithAutomaticPageSorting - Sort all types except pages manually. If pages are included, sort them automatically and group them after all other types. 


AutomaticSortingMathod and  SortAscending

These controls the sorting of the navigation items. Possible outcome depends on numerous other properties, since for example the AutomaticSortingMathod property has only meaning, if the OrderingMethod has been set to ManualWithAutomaticPageSorting.

Note. It's not a typo... it's really AutomaticSortingMathod...

Possible values for the AutomaticSortingMathod property

CreatedDate - Sort items by time of creation. 

LastModifiedDate - Sort items by time of last modification. 

Title - Sort items alphabetically by title. 


Final words

As you can see, you can configure all the same options directly from the onet.xml, as you can do from the user interface. Other thing to notice is the possibilities provided by the Feature Receiver concept, which gives flexible way to execute custom code during the site provisioning (or anytime the feature is otherwise activated).

More information concerning the functionalities declared here can be found from the SDK.


PS. I'll try to find some time to write similar article concerning the other possibilities of the WCM features (how to limit the page layouts, how to limit the web templates shown in UI, how to configure master page etc.). Stay tuned...

[Update] - The following post with information concerning the other publishing feature configurations has been released. Check the details from here.

Comments (12)

  1. In the previous post, I promised to try to find time to share additional information concerning the onet.xml

  2. Silverdragon says:

    When setting OrderingMethod to "Manual", is there a way to move the individual navigation items into required positions?

    Do I need to create a custom feature which sorts the items, after the main navigation feature has been installed?

  3. Vesa Juvonen says:

    Unfortunately there’s no out-of-the-box feature to sort the main navigation as requested.

    One of the key challenges in this requirement is also the fact, that the sub sites are created only after the features have been activated… so you cannot manipulate these settings using features… this has to be done using some another approach.

    Maybe a custom web control in the master page of the root site, which manipulates the navigation during first request and then stores the status to, so that manipulation is only done once.

  4. Beat says:

    Thanks for the post!

    I was wondering why i can’t hide pages the same way, at least they won’t hide the way i try to hide them 😉

    i have a site definition for a publishing site where i defined a module ‘Content’ to deploy some default pages

    <Module Name="Content"



      <File Url="sitemap.aspx"



            Level="Draft" >

            <Property Name="Title"

                      Value="Sitemap" />

            <Property Name="PublishingPageLayout"

    Value="~SiteCollection/_catalogs/masterpage/PageLayoutDefault.aspx,~SiteCollection/_catalogs/masterpage/PageLayoutDefault.aspx" />

            <Property Name="IncludeInGlobalNavigation"

                      Value="false" />



    According to the SDK, the PublishingPage class exposes a public property called ‘IncludeInGlobalNavigation’.

    Can somebody point me to the right direction.

  5. Vesa Juvonen says:

    Good question… and actually quote logical due the misleading element names within the Module element structures.

    The properties (Property element) here are actually columns within the list (site columns of the content type of the page) where the page is uploaded… not actual properties of the .NET class…

    There’s no direct way of setting the actual .NET class properties from the Module / File elements. If this is however required, you have to create a feature receiver, which manipulates the actual objects using APIs.

  6. hkossu says:

    can i include navigation groups(dropdownlists) to topnavi trough site definition(onet.xml).

    would like to create group "documentlibs" with the dropdownitems pointing to documentlibs

  7. Really good post – thanks. I wonder why MS cannot come up with a documentation like this…

  8. Some real interesting facts of navigation properties:

    – It is a typo from MS for AutomaticSortingMethod it is typed as **AutomaticSortingMathod**

    – While specifying navigation properties following properties take value in small case:-

    * InheritGlobalNavigation (true/false)

    * InheritCurrentNavigation (true/false)

    * IncludeSubSites (true/false)

    while some of the properties accept values in Camel Case

    * IncludePages (True/False)

  9. Danny says:

    When I use several of these properties not all seem to work.

  10. Vesa Juvonen says:

    Hi Danny,

    there are different combinations of these properties whcih work and what doesn't work. Notice also that this was written for SharePoitn 2007. 2010 has different set of options and combinations.


  11. Mohammad says:


    what about 2013 new settings for navigation (setting structural and managed navigation)? is there any attribute for setting the type of navigation by this feature?

  12. Ravi says:

    How can i set the Navigation Settings in ONET.XML with set Global Navigation with structural navigation check show pages and Current navigation structural navigation with uncheck show subsites and show pages options. My Code is :

Skip to main content