Code for adding a custom page link to the web_menu.sitemap

Posted By thedrumdoctor Fri 16 Sep 2011
Add to Favorites0
Author Message
thedrumdoctor
 Posted Fri 16 Sep 2011
Supreme Being

Supreme Being - (68,399 reputation)Supreme Being - (68,399 reputation)Supreme Being - (68,399 reputation)Supreme Being - (68,399 reputation)Supreme Being - (68,399 reputation)Supreme Being - (68,399 reputation)Supreme Being - (68,399 reputation)Supreme Being - (68,399 reputation)Supreme Being - (68,399 reputation)

Group: Forum Members
Last Active: Mon 21 May 2018
Posts: 94, Visits: 266
Adding a custom page seems straightforward enough and I'd like to make a shipping rate table page to the site so customers can see what rates we use before they decide to order. Rather than add this page to a tiny footer menu, I'd like to add the page to the top navigation menu. However, having looked at the web_menu.sitemap file I'm not at all sure what syntax to use to add a new link.

For instance, with search engine friendly URL's switched on, a custom terms page generates the following link:

www.domainname/Page.aspx?strPage=Terms

If I was to add the terms page to the main navigation menu, would the web_menu.sitemap file have to contain link code like:

siteMapNode url="~/Page.aspx?strPage=Terms"

Can someone explain what is the correct way to do this please?
Neil
 Posted Fri 16 Sep 2011
Supreme Being

Supreme Being - (123,363 reputation)Supreme Being - (123,363 reputation)Supreme Being - (123,363 reputation)Supreme Being - (123,363 reputation)Supreme Being - (123,363 reputation)Supreme Being - (123,363 reputation)Supreme Being - (123,363 reputation)Supreme Being - (123,363 reputation)Supreme Being - (123,363 reputation)

Group: Forum Members
Last Active: Sat 3 Nov 2018
Posts: 192, Visits: 5,220
First you need to create a custom page (Miscellaneous > custom pages)

Then link to it using the following in web_menu.sitemap

<siteMapNode url="~/t-enter_your_custom_page_id_here.aspx" title="Delivery Charges" description="Delivery Charges" />


This would add the link to an existing dropdown, but if you wanted it on its own 'tab' then add </siteMapNode> to the end e.g.

<siteMapNode url="~/t-enter_your_custom_page_id_here.aspx" title="Delivery Charges" description="Delivery Charges" /></siteMapNode>


Also this menu is cached so you will need to restart IIS or recycle the application pool after changes are made.
Fri 16 Sep 2011 by Neil
thedrumdoctor
 Posted Fri 16 Sep 2011
Supreme Being

Supreme Being - (68,399 reputation)Supreme Being - (68,399 reputation)Supreme Being - (68,399 reputation)Supreme Being - (68,399 reputation)Supreme Being - (68,399 reputation)Supreme Being - (68,399 reputation)Supreme Being - (68,399 reputation)Supreme Being - (68,399 reputation)Supreme Being - (68,399 reputation)

Group: Forum Members
Last Active: Mon 21 May 2018
Posts: 94, Visits: 266
Thanks for that. I tried it but I must of inserted the code in a place it doesn't like as I got the following error in the log.

System.Configuration.ConfigurationErrorsException: The XML sitemap config file /web_menu.sitemap could not be loaded.  The 'siteMap' start tag on line 2 does not match the end tag of 'siteMapNode'. Line 37, position 100. (\wwwroot\web_menu.sitemap line 37) ---> System.Xml.XmlException: The 'siteMap' start tag on line 2 does not match the end tag of 'siteMapNode'. Line 37, position 100.

I wanted to create a new heading on the menu, after the 'Contact' link which is the final link in the menu. So I inserted the code after the closing </siteMapNode> tag of the 'Contact' link code and before the </siteMap> closing tag which closes the XML.

I also reset the server by uploading the web.config file which has worked before when I removed items from the navigation menu. I'm guessing I must have inserted it in the wrong place but I'm not exactly sure where it's supposed to go. Give me a simple unordered list any day, please!

Neil
 Posted Fri 16 Sep 2011
Supreme Being

Supreme Being - (123,363 reputation)Supreme Being - (123,363 reputation)Supreme Being - (123,363 reputation)Supreme Being - (123,363 reputation)Supreme Being - (123,363 reputation)Supreme Being - (123,363 reputation)Supreme Being - (123,363 reputation)Supreme Being - (123,363 reputation)Supreme Being - (123,363 reputation)

Group: Forum Members
Last Active: Sat 3 Nov 2018
Posts: 192, Visits: 5,220
Yes it sounds like you are missing a closing tag somewhere.
thedrumdoctor
 Posted Mon 19 Sep 2011
Supreme Being

Supreme Being - (68,399 reputation)Supreme Being - (68,399 reputation)Supreme Being - (68,399 reputation)Supreme Being - (68,399 reputation)Supreme Being - (68,399 reputation)Supreme Being - (68,399 reputation)Supreme Being - (68,399 reputation)Supreme Being - (68,399 reputation)Supreme Being - (68,399 reputation)

Group: Forum Members
Last Active: Mon 21 May 2018
Posts: 94, Visits: 266
Got there in the end after some experimentation. This code seems to work and give 'Delivery Charges' it's own tab after the Contact Us tab:

<siteMapNode url="~/News.aspx" title="$resources:News,PageTitle_SiteNews"  description="$resources:News,PageTitle_SiteNews" value="news" />
        <siteMapNode url="~/Contact.aspx" title="$resources:Kartris,PageTitle_ContactUs"  description="$resources:Kartris,PageTitle_ContactUs" />
       
        <siteMapNode url="~/t-Delivery.aspx" title="Delivery Charges" description="Delivery Charges" />
       
        </siteMapNode>

All works to deliver the custom page I created so thanks for your help.

Similar Topics

Expand / Collapse

Reading This Topic

Expand / Collapse

Back To Top