SharePoint sitemap provider, Sharepoint customized menu and Next step of Global navigation

InfoPath alternatives for form designing SharePoint

Hi All, We are well aware of Sharepoint Global navigation –> menu for sharepoint site. This has a horizontal level (main menu) and one vertical level (sub menu) of menu list. If we need more levels of items to be present under the submenu (more level), global navigation may not be feasible to be used for. Here we go for a new sharepoint custom feature: Sitemap provider.

The steps to get site map provider is as follows:
This implementation contains : 1.master page modification, 2. one .sitemap file extension to be present in /_Layouts/1033/CustomFolderName/ & 3. one web.config entry 4. Customize corev4.css file.

1. master page modification:
** Place the code inside the contentplace holder “PlaceHolderTopNavBar” in master page:
<!–Sharepoint Sitemap provider starts here–>

<div style=”width:100%;”>

<!– Main navigation starts here –>

<asp:ContentPlaceHolder id=”PlaceHolderTopNavBar” runat=”server”>

<asp:ContentPlaceHolder id=”PlaceHolderHorizontalNav” runat=”server”>



<SharePoint:AspMenu
ID=”CustomTopNavigationMenu”
Runat=”server”
EnableViewState=”false”
DataSourceID=”demoGlobalNavSiteMapDataSource”
AccessKey=”<%$Resources:wss,navigation_accesskey%>”
UseSimpleRendering=”false”
UseSeparateCss=”false”
Orientation=”Horizontal”
StaticDisplayLevels=”1″
MaximumDynamicDisplayLevels=”3″
SkipLinkText=””
CssClass=”s4-tn menu-horizontal_wrap”/>

<SharePoint:DelegateControl runat=”server” ControlId=”CustomXmlContentMapProvide” Id=”CustomGlobalNavDelegate”>
<Template_Controls>
<asp:SiteMapDataSource ShowStartingNode=”False”
SiteMapProvider=”CUSTOMSiteMapProvider” id=”demoGlobalNavSiteMapDataSource” runat=”server”/>
</Template_Controls>
</SharePoint:DelegateControl>
</asp:ContentPlaceHolder>
</asp:ContentPlaceHolder>
</div>
</div>

<!–Sharepoint Sitemap provider Ends here–>

2. one .sitemap file extension to be present in /_Layouts/1033/CustomFolderName/
place the below code in custom.sitemap file:
<siteMap>
<siteMapNode title=”Home” description=”” url=”/” >
<siteMapNode title=”Home” description=”” url=”/Pages/Home.aspx”>
</siteMapNode>
<!–Main Menu1 Subsite Starts–>
<siteMapNode title=”Main Menu1″ description=”” url=”/Overview1/Pages/Main-Menu1.aspx”>
<siteMapNode title=”Overview2″ description=”” url=”/Overview1/Pages/Overview.aspx”/>
<siteMapNode title=”Overview2″ description=”” url=”/Overview1/Pages/Overview2″/>

</siteMapNode>
<!–Main Menu1 Subsite Ends–>

<!–Main Menu2 Subsite Starts–>
<siteMapNode title=”Main Menu2″ description=”” url=”/Overview2/Pages/Main-Menu2.aspx”>
<!–Main Menu2 Series Starts–>
<siteMapNode title=”Submenu” description=”” url=””>
<siteMapNode title=”SubSubMenu1″ description=”” url=”/Overview2/Pages/SubSub-Menu1.aspx”/>
<siteMapNode title=”SubSubMenu2″ description=”” url=”/Overview2/Pages/SubSub-Menu2.aspx”/>
<siteMapNode title=”SubSubMenu3″ description=”” url=”/Overview2/Pages/SubSub-Menu3.aspx”/>
<siteMapNode title=”SubSubMenu4″ description=”” url=”/Overview2/Pages/SubSub-Menu4.aspx”/>
</siteMapNode>
<!–Main Menu2 Series Ends–>

<siteMapNode title=”wwww” description=”” url=”/Overview2/Pages/wwww.aspx”>
</siteMapNode>
<siteMapNode title=”ffff” description=”” url=”/Overview2/Pages/ffff.aspx”>
</siteMapNode>

<siteMapNode title=”Classificaion” description=”” url=”/Overview2/Pages/Classificaion.aspx”>
<siteMapNode title=”subClassificaion1″ description=”” url=”/Overview2/Pages/subClassificaion1.aspx”/>
<siteMapNode title=”subClassificaion2″ description=”” url=”/Overview2/Pages/subClassificaion2.aspx”/>
</siteMapNode>
<siteMapNode title=”Classificaion2″ description=”” url=”/Overview2/Pages/Classificaion2.aspx”>
</siteMapNode>
</siteMapNode>
<!–Main Menu2 subsite ends–>
<!–Main Menu3 Subsite Starts–>
<siteMapNode title=”Main Menu3″ description=”” url=”/Overview3/Pages/Main-Menu3.aspx”>
<siteMapNode title=”SubMenu11″ description=”” url=”/Research/Pages/SubMenu11.aspx”/>
<siteMapNode title=”SubMenu22″ description=”” url=”/Research/Pages/SubMenu22.aspx”/>
</siteMapNode>
<!–Main Menu3 Subsite Starts–>
</siteMapNode>
</siteMap>
3. one web.config entry
Paste the code below

<!–Change for sitemap provider–>
<add name=”CUSTOMSiteMapProvider” siteMapFile=”/_layouts/1033/CUSTOM/CUSTOM.sitemap” type=”System.Web.XmlSiteMapProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a” />

Between
<siteMap defaultProvider=”CurrentNavigation” enabled=”true”>
<providers>
</providers>
</siteMap>
4. Customize corev4.css file:
copy the classes from corev4.css file, that run on the sitemap/ menu and place all the classes in a separate file, put the file under ‘style library’ of the site collection, refer and link the file with master page and enjoy your customized menu.

Similar SharePoint 2013 Tutorials


Leave a Reply