Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
I am generating a menu using my content tree.
However the content tree contains some grouping folders that I don't want in the url, so I added the use of 'umbracoUrlAlias'.
However, I am not sure what to use in my menu xslt to get the umbracoUrlAlias and get the correct URL.
Tried:
<a href="{umbraco.library:NiceUrl(@id)}"> Gives me the full node path, with the grouping folders I don't want in the URL
<a href="{data[@alias='umbracoUrlAlias']}"> Still gives me the grouping folders in the URL, but removes the .aspx from the end
Example:
/folderA/Somepage.aspx, I have umbracoUrlAlias = 'Somepage', I want the url generated in my xslt to be /somepage.aspx
Thanks
Hi Karen,
You're on the right track, but you have to manually build the URLs using umbracoUrlAlias - the property hooks the alias up so Umbraco will take you to the right page, but NiceUrl() will always build the "standard" URL (from what I've tested).
You can use this snippet to generate your links:
<a> <xsl:attribute name="href"> <xsl:choose> <xsl:when test="normalize-space(data[@alias = 'umbracoUrlAlias'])"> <xsl:value-of select="concat('/', data[@alias = 'umbracoUrlAlias'], '.aspx')" /> </xsl:when> <xsl:otherwise> <xsl:value-of select="umbraco.library:NiceUrl(@id)" /> </xsl:otherwise> </xsl:choose> </xsl:attribute> ... </a>
/Chriztian
Thanks very much!
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
NiceUrl and umbracoUrlAlias
I am generating a menu using my content tree.
However the content tree contains some grouping folders that I don't want in the url, so I added the use of 'umbracoUrlAlias'.
However, I am not sure what to use in my menu xslt to get the umbracoUrlAlias and get the correct URL.
Tried:
<a href="{umbraco.library:NiceUrl(@id)}"> Gives me the full node path, with the grouping folders I don't want in the URL
<a href="{data[@alias='umbracoUrlAlias']}"> Still gives me the grouping folders in the URL, but removes the .aspx from the end
Example:
/folderA/Somepage.aspx, I have umbracoUrlAlias = 'Somepage', I want the url generated in my xslt to be /somepage.aspx
Thanks
Hi Karen,
You're on the right track, but you have to manually build the URLs using umbracoUrlAlias - the property hooks the alias up so Umbraco will take you to the right page, but NiceUrl() will always build the "standard" URL (from what I've tested).
You can use this snippet to generate your links:
/Chriztian
Thanks very much!
is working on a reply...