I'm currently stuck trying to modify my websites navigation header menu using xslt through Umbraco (I'm a bit of a novice when it comes to xslt unfortunately). The menu has 2 levels and functions correctly but I would like to remove the extension of the URLs so that it displays SEO friendly URLs e.g. change http://www.home.com/about-us.aspx to http://www.home.com/about-us
Basically I think the above code somehow confuses the @isDoc and string(umbracoNaviHide) != '1' check as on the second level of the menu unwanted pages appear (basically any page within the Home folder in the Content tab of Umbraco). For example the correct menu structure would be:
Home: About, Contact
However with the code implemented that replaces '.aspx' the following menu structure is displayed:
Home: About, Contact, Page Not Found, pdfviewer
If anyone know of a solution on how to remove the URL extension and retain the correct menu structure then any help would be very much appreciated!
Ok that's great! I don't currently have access to the web.config at the moment but should hopefully be gaining access over the next couple of days so will let you know if the umbracoUseDirectoryUrls works.
Just out of curiosity when using the umbraco.library:Replace command to remove '.aspx' (code below) from a URL, is the reason every node suddenly appears in the menu due to the fact the @isDoc check is no longer valid?
Xslt Menu: Remove .aspx from Hyperlinks
Hi,
I'm currently stuck trying to modify my websites navigation header menu using xslt through Umbraco (I'm a bit of a novice when it comes to xslt unfortunately). The menu has 2 levels and functions correctly but I would like to remove the extension of the URLs so that it displays SEO friendly URLs e.g. change http://www.home.com/about-us.aspx to http://www.home.com/about-us
The current code is below:
I have managed to remove the extensions using the following code (however this has led to a bug within the menu):
Basically I think the above code somehow confuses the @isDoc and string(umbracoNaviHide) != '1' check as on the second level of the menu unwanted pages appear (basically any page within the Home folder in the Content tab of Umbraco). For example the correct menu structure would be:
Home: About, Contact
However with the code implemented that replaces '.aspx' the following menu structure is displayed:
Home: About, Contact, Page Not Found, pdfviewer
If anyone know of a solution on how to remove the URL extension and retain the correct menu structure then any help would be very much appreciated!
Thanks,
Daniel
Hi Daniel,
The extensions are handled separately from XSLT - they're handled within the NiceUrl() method based on a setting in web.config:
In the <appSettings> section there's a key called umbracoUseDirectoryUrls - set that to true, like this:
... and republish your site (right-click the Content node). Then that should be it.
/Chriztian
Ok that's great! I don't currently have access to the web.config at the moment but should hopefully be gaining access over the next couple of days so will let you know if the umbracoUseDirectoryUrls works.
Just out of curiosity when using the umbraco.library:Replace command to remove '.aspx' (code below) from a URL, is the reason every node suddenly appears in the menu due to the fact the @isDoc check is no longer valid?
Thank you for your help.
Daniel
is working on a reply...