Skip to content

Instantly share code, notes, and snippets.

@ryan-ethode
Last active March 3, 2016 17:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ryan-ethode/9262529aeb09049e2cf3 to your computer and use it in GitHub Desktop.
Save ryan-ethode/9262529aeb09049e2cf3 to your computer and use it in GitHub Desktop.
This creates a DotCMS RSS feed based on a content structure.
#set ($query="+structureName:Blog +(conhost:48190c8c-42c4-46af-8d1a-0cd5db894797 conhost:SYSTEM_HOST), 10, modDate desc")
<xml version="1.0" encoding="UTF-8">
<rss version="2.0">
<channel>
<pubDate>1 Jan 2006 23:23:04 GMT</pubDate>
<title>Company Blog</title>
<description>Tips and Tricks</description>
<link>http://www.website.com/blog/</link>
<copyright>2006-2015 Company Name</copyright>
<managingEditor>name@email.com</managingEditor>
<language>en</language>
<image>
<url>http://www.website.com/images/some.jpg</url>
<link>http://www.website.com/blog/</link>
<title>Website Blog</title>
</image>
#pullContent("$query" "10" "modDate desc")
#if ($list.size() > 0)
#foreach ($content in $list)
<item>
<title><![CDATA[$content.title]]></title>
<pubDate>$date.format('d MMM yyyy kk:mm:ss Z',$content.sysPublishDate)</pubDate>
<link>http://www.website.com/blog/$content.urlTitle</link>
<guid>http://www.website.com/blog/$content.urlTitle</guid>
<author>$content.author</author>
<category>
#foreach($cat in $content.topic)
#set ($category = $categories.getCategoryByInode("$cat"))
#if ($velocityCount != $content.topic.size())
$category.topic,
#else
$category.topic
#end
#end
</category>
<description>$content.body></description>
</item>
#end
</channel></rss>
#else
#if($EDIT_MODE)
[There are no results matching your query.]
#else
<p>Sorry, there are no podcasts available at this time.</p>
#end
#end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment