CKS EBE (Enhanced Blog Edition) Archives Sorting (Monthly Sorting)

So, I have the Community Kit for SharePoint: Enhanced Blog Edition working (CKS:EBE – if you are reading this now, you are looking at EBE).

 

However, with the ‘default’ Theme included (I actually preferred it over all the others), I noticed the Monthly Archives were not being sorted properly.  They should be sorted by Published Date and in my case, as I had to merge in a tonne of legacy/archive stuff, this would have been a lot of work to correct.  The good news is, the XML file simply lacked some ascending sorting and as such, I’ve addressed it below.

 

It looked like this (clearly, months were out of whack)

 

clip_image002

 

In the themes ‘MonthCount.xsl’, the original code was:

   1: <xsl:template match="/">
   2:  
   3:     <xsl:apply-templates select="rows/row[generate-id(.) = generate-id(key('months', substring(PublishedDate, 0, 8)))]" />
   4:  
   5: 

 

And to correct it, I had to change it to this…

   1: <xsl:template match="/">
   2:      <xsl:apply-templates select="rows/row[generate-id(.) = generate-id(key('months', substring(PublishedDate, 0, 8)))]">
   3:           <xsl:sort select="PublishedDate" order="descending"/>
   4:      </xsl:apply-templates>
   5: </xsl:template>

 

And now my CKS:EBE Monthly Archives Sort correctly (below)

 

clip_image002[5]