Sorry if this has already been answered, I didnt see anything. I have looked through the navigation XSLT and I see a "sortOrder" property, but see no where to access that? When I sort in the content menu the position of the navigation stays the same. Basically just looking for a way to tell the navigation macro where to place the links.
When you have sorted the pages in the backoffice you should also refresh the xml cache by going to the root "Content" node, right click on it and select "Republish entire site". When that is done the links on your website should reflect that same sortorder.
Thank you for the quick reply. I have tried this, but the results are the same. I even sorted 'Home' all the way to 9 and it is still the first in the list.
Hmm, what happens if you try to recycle the app pool? Still the same? What version of Umbraco are you using? And are you generating the navigation with XSLT or Razor?
Same results after recycling the app pool. This starter kit generated it for you. There is a Navigation macro it uses. Inside the XSLT I see <xsl:sort select="@sortOrder" data-type="number" />. But nothing seems to change?
What happens if you remove the sort order perhaps? Could you post the whole xslt snippet so I can see the full context. I have an idea about what is going on but would like to see the full context :)
I found a work around, sort of. If I change the sort order, and make a change to the navigation it seems to update. Here is the XSLT. Is there a code tag on this forum?
Sorting Navigation
Hey Guys,
Sorry if this has already been answered, I didnt see anything. I have looked through the navigation XSLT and I see a "sortOrder" property, but see no where to access that? When I sort in the content menu the position of the navigation stays the same. Basically just looking for a way to tell the navigation macro where to place the links.
-Marc
Hi Marc and welcome to our :)
When you have sorted the pages in the backoffice you should also refresh the xml cache by going to the root "Content" node, right click on it and select "Republish entire site". When that is done the links on your website should reflect that same sortorder.
Hope this helps.
/Jan
Hey Jan,
Thank you for the quick reply. I have tried this, but the results are the same. I even sorted 'Home' all the way to 9 and it is still the first in the list.
-Marc
Hi Osiris
Hmm, what happens if you try to recycle the app pool? Still the same? What version of Umbraco are you using? And are you generating the navigation with XSLT or Razor?
/Jan
Same results after recycling the app pool. This starter kit generated it for you. There is a Navigation macro it uses. Inside the XSLT I see <xsl:sort select="@sortOrder" data-type="number" />. But nothing seems to change?
What happens if you remove the sort order perhaps? Could you post the whole xslt snippet so I can see the full context. I have an idea about what is going on but would like to see the full context :)
I assume it's v4.7?
/Jan
I found a work around, sort of. If I change the sort order, and make a change to the navigation it seems to update. Here is the XSLT. Is there a code tag on this forum?
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE xsl:Stylesheet [
<!ENTITY nbsp " ">
]>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxml="urn:schemas-microsoft-com:xslt" xmlns:umbraco.library="urn:umbraco.library" exclude-result-prefixes="msxml umbraco.library">
<xsl:output method="xml" omit-xml-declaration="yes"/>
<xsl:param name="currentPage"/>
<xsl:variable name="CssClassName" select="/macro/CssClassName" />
<xsl:variable name="CssId" select="/macro/CssId" />
<xsl:variable name="StopLevel" select="/macro/StopLevel" />
<xsl:variable name="StartLevel" select="/macro/StartLevel" />
<xsl:template match="/">
<xsl:call-template name="Navigation">
<xsl:with-param name="childNodes" select="$currentPage/ancestor-or-self::*[@isDoc][@level=($StartLevel)]/* [@isDoc][not(name()='Article')][not(umbracoNaviHide=1)]" />
</xsl:call-template>
</xsl:template>
<xsl:template name="Navigation">
<xsl:param name="childNodes"/>
<xsl:choose>
<xsl:when test="count($childNodes) > 0">
<ul>
<xsl:if test="$CssId !=''">
<xsl:attribute name="id">
<xsl:value-of select="$CssId" />
</xsl:attribute>
</xsl:if>
<xsl:if test="$CssClassName !=''">
<xsl:attribute name="class">
<xsl:value-of select="$CssClassName" />
</xsl:attribute>
</xsl:if>
<xsl:for-each select="$childNodes">
<xsl:call-template name="SubMenu"/>
</xsl:for-each>
</ul>
</xsl:when>
<xsl:otherwise>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template name="SubMenu">
<xsl:if test="(umbraco.library:IsProtected(current()/@id, current()/@path) = false() or (umbraco.library:HasAccess(current()/@id, current()/@path) = true() ))">
<li>
<xsl:attribute name="class">
<xsl:if test="$currentPage/ancestor-or-self::*[@isDoc]/@id = current()/@id">
<xsl:text>selected </xsl:text>
</xsl:if>
<xsl:if test="position() = 1">
<xsl:text>first </xsl:text>
</xsl:if>
<xsl:if test="position() = last()">
<xsl:text>last</xsl:text>
</xsl:if>
</xsl:attribute>
<xsl:choose>
<xsl:when test="string-length(data[@alias='RedirectUrl']) > 0">
<a href="{data[@alias='RedirectUrl']}" title="{@nodeName}">
<xsl:value-of select="@nodeName"/>
</a>
</xsl:when>
<xsl:when test="string-length(data[@alias='RedirectPageId']) > 0">
<a href="{umbraco.library:NiceUrl(data[@alias='RedirectPageId'])}" title="{@nodeName}">
<xsl:value-of select="@nodeName"/>
</a>
</xsl:when>
<xsl:otherwise>
<a href="{umbraco.library:NiceUrl(@id)}" title="{@nodeName}">
<xsl:value-of select="@nodeName"/>
</a>
</xsl:otherwise>
</xsl:choose>
<xsl:if test="current()/@level < ($StopLevel) and $currentPage/ancestor-or-self::*[@isDoc]/@id = current()/@id">
<xsl:if test="count(*[@isDoc][not(data[@alias='umbracoNaviHide']=1)]) > 0">
<ul>
<xsl:for-each select="*[@isDoc][not(data[@alias='umbracoNaviHide']=1)]">
<xsl:sort select="@sortOrder" data-type="number" />
<xsl:call-template name="SubMenu"/>
</xsl:for-each>
</ul>
</xsl:if>
</xsl:if>
</li>
</xsl:if>
</xsl:template>
</xsl:stylesheet>
Hi Osiris
Good to hear you managed to get it solved.
/Jan
is working on a reply...