<xsl:output method="xml" omit-xml-declaration="yes"/> <xsl:param name="currentPage"/> <!-- Update these variables to modify the feed --> <xsl:variable name="RSSNoItems" select="10"/> <xsl:variable name="RSSTitle" select="string('My sample rss')"/> <xsl:variable name="SiteURL" select="string('http://172.31.40.55/cmsTest')"/> <xsl:variable name="RSSDescription" select="string('Add your description here')"/> <!-- This gets all news and events and orders by updateDate to use for the pubDate in RSS feed --> <xsl:variable name="pubDate"> <xsl:for-each select="$currentPage/*"> <xsl:sort select="@createDate" data-type="text" order="descending" /> <xsl:if test="position() = 1"> <xsl:value-of select="updateDate" /> </xsl:if> </xsl:for-each> </xsl:variable> <xsl:template match="/"> <!-- change the mimetype for the current page to xml --> <xsl:value-of select="umbraco.library:ChangeContentType('text/xml')"/> <!--<xsl:text disable-output-escaping="yes"><?xml version="1.0" encoding="UTF-8"?></xsl:text>--> <rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:dc="http://purl.org/dc/elements/1.1/" > <channel> <title> <xsl:value-of select="$RSSTitle"/> </title> <link> <xsl:value-of select="$SiteURL"/> </link> <pubDate> <xsl:value-of select="$pubDate"/> </pubDate> <generator>umbraco</generator> <description> <xsl:value-of select="$RSSDescription"/> </description> <language>en</language> <!--<xsl:apply-templates select="$currentPage/* [@isDoc and string(umbracoNaviHide) != '1']"> <xsl:sort select="@createDate" order="descending" /> </xsl:apply-templates>--> <xsl:apply-templates select="$currentPage/ancestor-or-self::*[@level = 1]/*"> <xsl:sort select="@createDate" order="descending" /> </xsl:apply-templates> </channel> </rss> </xsl:template> <xsl:template match="node"> <xsl:if test="position() <= $RSSNoItems"> <item> <title> <xsl:value-of select="@nodeName"/> </title> <link> <xsl:value-of select="$SiteURL"/> <xsl:value-of select="umbraco.library:NiceUrl(@id)"/> </link> <pubDate> <xsl:value-of select="umbraco.library:FormatDateTime(@createDate,'r')" /> </pubDate> <guid> <xsl:value-of select="$SiteURL"/> <xsl:value-of select="umbraco.library:NiceUrl(@id)"/> </guid> <content:encoded> <xsl:value-of select="concat('<![CDATA[ ', ./bodyText,']]>')" disable-output-escaping="yes"/> </content:encoded> </item> </xsl:if> </xsl:template> </xsl:stylesheet>
I seem to be getting elements just from my home page, which makes sense because of that's what I'm testing for in my <xsl:apply-template> The output is something like this:
Rss Feed
Anybody been able to output an RSS feed of their entire Umbraco site? This is what my XSLT looks like so far:
I seem to be getting elements just from my home page, which makes sense because of that's what I'm testing for in my <xsl:apply-template> The output is something like this:
Any suggestion on how I can get the whole site into an rss feed? Thanks!
is working on a reply...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.