Im trying to make a macro that will display the latest X pages that have received updates. The hard part I'm having is to make this work correctly with umbraco nodes that do not have a pageview themselves (eg: 2 nodes that help decide the content of the parent node - if one of the child nodes is updated, I'd like to have the parent node be labeled as updated).
After alot of experimenting, I came up with a solution which seems to do its job quite well, I'll post it here for reference.
If anyone has any suggestions/improvements, please let them know.
<ul id="LatestUpdates">
<xsl:for-each select="$currentPage/ancestor-or-self::node[@level=1]/descendant-or-self::node[string(data [@alias='umbracoNaviHide']) != '1' and not(@nodeTypeAlias = 'Inschrijving' or @nodeTypeAlias = 'Photo')]"> <xsl:sort select="@updateDate" order="descending"/>
<!-- We move up the tree, looking for the first node that is displayable as a page --> <xsl:variable name="page" select="ancestor-or-self::node[@template != 0][1]"/>
<!-- In this page-node, we find the most recent updateDate and store it --> <xsl:variable name="page_latest_update"> <xsl:for-each select="$page/descendant-or-self::node[./ancestor-or-self::node[@template != 0][1]/@id = $page/@id]"> <xsl:sort order="descending" select="@updateDate"/> <xsl:if test="position()=1"><xsl:value-of select="@updateDate"/></xsl:if> </xsl:for-each> </xsl:variable>
Trying to make a 'latest updates' script
Hi all,
Im trying to make a macro that will display the latest X pages that have received updates. The hard part I'm having is to make this work correctly with umbraco nodes that do not have a pageview themselves (eg: 2 nodes that help decide the content of the parent node - if one of the child nodes is updated, I'd like to have the parent node be labeled as updated).
This is what I got so far:
The problem here is that duplicates will appear if multiple of the child nodes (that dont have their own template) have been recently updated.
Eg: if node Parent has 2 childnodes A and B that have been updated recently, the Parent-node will appear in the list 2 times.
After alot of experimenting, I came up with a solution which seems to do its job quite well, I'll post it here for reference.
If anyone has any suggestions/improvements, please let them know.
is working on a reply...