Blog archive list Options
Anders
Posted: Tuesday, September 02, 2008 8:07:03 AM

Rank: Devotee

Joined: 5/24/2007
Posts: 72
Location: Kalix, Sweden
Anyone got a blog archive list for the "umbraco blog package"?

That lists like this.

2008
May
June

2007
June
July

and so on?



Umbraco Certified Professional
Dirk
Posted: Tuesday, September 02, 2008 8:40:13 AM

Rank: Umbracoholic

Joined: 9/27/2007
Posts: 1,136
Location: Belgium
Hi Anders,

Here's what I use on a family blog. It's written in pure xslt

Code:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE xsl:Stylesheet [ <!ENTITY nbsp "&#x00A0;"> ]>
<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"/>

<!-- Don't change this, but add a 'contentPicker' element to -->
<!-- your macro with an alias named 'nodeId' -->
<xsl:variable name="blogNodeId" select="/macro/nodeId"/>
<xsl:variable name="months" select="umbraco.library:Split('Jan,Feb,Maa,Apr,Mei,Jun,Jul,Aug,Sep,Okt,Nov,Dec',',')"/>

<xsl:template match="/">

<!-- The fun starts here -->

<xsl:if test="count(umbraco.library:GetXmlNodeById($blogNodeId)/node [@nodeTypeAlias = 'umbracoBlogDateFolder' and @level = 3]) > 0">
    <h3>Kunt ge't niet meer vinden? Probeer het archief eens...</h3>
</xsl:if>

<xsl:for-each select="umbraco.library:GetXmlNodeById($blogNodeId)/node [@nodeTypeAlias = 'umbracoBlogDateFolder' and @level = 3]">

<xsl:sort select="@nodeName" data-type="number" order="descending" />
        
    <a href="{umbraco.library:NiceUrl(@id)}"><b><xsl:value-of select="@nodeName"/></b></a>:

    <xsl:for-each select="./node [@nodeTypeAlias = 'umbracoBlogDateFolder' and @level = 4]">
    
    <xsl:sort select="./@nodeName" order="descending" />
    <xsl:variable name="month" select="./@nodeName"/>

    <a href="{umbraco.library:NiceUrl(@id)}">
        <xsl:value-of select="$months/value[number($month)]/text()"/></a>
    
    <xsl:if test="position() &lt; last()-1">
        <xsl:text>,&nbsp;</xsl:text>
    </xsl:if>

    <br/>
    
    </xsl:for-each>

</xsl:for-each>

</xsl:template>

</xsl:stylesheet>


Basically, I'm feeding the xslt with a param $blogNodeId which is the parent node for a blog.
Based on this node, I've created a double loop, first one iterates the 'year' folder, second inner loop iterates the 'month' folders.

I'm using another variable $months, which is an array to convert month number by its text counterpart (In Dutch here...).

Hope that helps.

Regards,
/Dirk







level 1 & 2 certified - umbraco MVP 2008/2009 - umbraco blog at netaddicts.be - working on an integrated forum4umbraco
Anders
Posted: Tuesday, September 02, 2008 9:15:11 AM

Rank: Devotee

Joined: 5/24/2007
Posts: 72
Location: Kalix, Sweden
Thanks,

Worked great. Did however stuble across a problem, when browsing 2008.aspx, umbraco cant find the page, very wierd. Template are set, republised the whole site. 2008/9.aspx works great.. However thats another issue.

Thanks again, needed a quick fix and didnt have time to build it myself.


Umbraco Certified Professional
Dirk
Posted: Tuesday, September 02, 2008 9:25:40 AM

Rank: Umbracoholic

Joined: 9/27/2007
Posts: 1,136
Location: Belgium
Hi Anders,

I might have had that issue too, don't know exactly anymore if that was the case. Do you have the blog right underneath the 'Content' node? I think I shifted it down a level because of that! At least this is weird behaviour, and it should work, regardless of the structure.

Greetz,
/Dirk


level 1 & 2 certified - umbraco MVP 2008/2009 - umbraco blog at netaddicts.be - working on an integrated forum4umbraco
Anders
Posted: Tuesday, September 02, 2008 11:32:58 AM

Rank: Devotee

Joined: 5/24/2007
Posts: 72
Location: Kalix, Sweden
Yeah, the blog sits right under the content node, as the blog will have its own domain name. Is this a umbraco bug, 2008 as file name doesnt work in the top node? As using the nodeid the page is delivered...



Umbraco Certified Professional
Dirk
Posted: Tuesday, September 02, 2008 11:45:57 AM

Rank: Umbracoholic

Joined: 9/27/2007
Posts: 1,136
Location: Belgium
Might play with value for config setting umbracoHideTopLevelNodeFromPath!
Just a wild guess.... Not sure if it's related.

Regards,
/Dirk


level 1 & 2 certified - umbraco MVP 2008/2009 - umbraco blog at netaddicts.be - working on an integrated forum4umbraco
Users browsing this topic
Guest


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.