I am in the process of editing a website (and am fairly new to this) and one thing that I need to achieve is to change the order that the blog posts display in the drop down menu. At the moment they go in ascending order, with the oldest post being at the top. But I need to change this so that the newest posts displays at the top, on firstly the 'Year' sub-menu, and then the 'Month' sub-menu.
If anyone could help point me in the right direction it would be a great help.
The blog is using ublogsy and I am using umbraco 4.11
Here is a rough example of how the content tree is structured.
Content
Home Products About us Support Testimonials Blog 2007 2008 2009 2010 2011 2012 2013 2 22 post 3 8 post2 21 post3
This is the XSLT file that is generating the menu.
Xslt changing the order of menu items
I am in the process of editing a website (and am fairly new to this) and one thing that I need to achieve is to change the order that the blog posts display in the drop down menu. At the moment they go in ascending order, with the oldest post being at the top. But I need to change this so that the newest posts displays at the top, on firstly the 'Year' sub-menu, and then the 'Month' sub-menu.
If anyone could help point me in the right direction it would be a great help.
The blog is using ublogsy and I am using umbraco 4.11
Here is a rough example of how the content tree is structured.
Content
Home
Products
About us
Support
Testimonials
Blog
2007
2008
2009
2010
2011
2012
2013
2
22
post
3
8
post2
21
post3
This is the XSLT file that is generating the menu.
<?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" indent="yes" omit-xml-declaration="yes" />
<xsl:param name="currentPage" />
<xsl:variable name="level" select="1" />
<xsl:variable name="navRoot" select="$currentPage/ancestor-or-self::*[@level = $level][not(umbracoNaviHide = 1)]" />
<xsl:variable name="navRootItems" select="$navRoot/*[@isDoc][not(umbracoNaviHide = 1)]" />
<xsl:template match="/">
<a title="Show navigation" href="#nav">Show navigation</a>
<a title="Hide navigation" href="#">Hide navigation</a>
<div id="navlogo"><a title="HOME" href="/home.aspx">
<span style="position:absolute;width:100%;height:100%;top:0;left: 0;"></span>
</a></div>
<ul class="clearfix">
<li>
<xsl:if test="$currentPage/@nodeName = 'Home'"><xsl:attribute name="class">current</xsl:attribute></xsl:if>
<a href="/">Home</a>
</li>
<xsl:if test="$navRootItems">
<xsl:apply-templates select="$navRootItems" />
</xsl:if>
<div id="menuspace"/>
</ul>
</xsl:template>
<xsl:template match="*[@isDoc]">
<li>
<xsl:if test="@id = $currentPage/@id"><xsl:attribute name="class">current</xsl:attribute></xsl:if>
<a>
<xsl:attribute name="href">
<xsl:value-of select="umbraco.library:NiceUrl(@id)" />
</xsl:attribute>
<xsl:choose>
<xsl:when test="@level = 4 and (self::uBlogsyFolderMonth | self::umbracoBlogDateFolder | self::DateFolder)">
<xsl:value-of select="umbraco.library:FormatDateTime(@createDate, 'MMMM')" />
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates select="@nodeName" />
</xsl:otherwise>
</xsl:choose>
</a>
<xsl:if test="*[@isDoc][not(umbracoNaviHide = 1)][not((self::uBlogsyFolderMonth | self::umbracoBlogDateFolder | self::DateFolder)[@level = 5])]">
<ul>
<xsl:apply-templates select="*[@isDoc][not(umbracoNaviHide = 1)][not((self::uBlogsyFolderMonth | self::umbracoBlogDateFolder | self::DateFolder)[@level = 5])]" />
</ul>
</xsl:if>
</li>
</xsl:template>
<xsl:template match="@nodeName[string-length() > 25]">
<xsl:attribute name="title">
<xsl:value-of select="." />
</xsl:attribute>
<xsl:value-of select="concat(substring(., 1, 24), '…')" />
</xsl:template>
</xsl:stylesheet>
Thanks
Hi Ian,
I'm not that experienced with ublogsy. BUT you can try experimenting with this:
Hope this can help you...
is working on a reply...