Basic RSS feed

Overview

[[Ditto? &parents=`10` &format=`rss` &summarize=`20` &total=`20`]]

To create a basic RSS feed insert a Ditto call like the one above into a new MODx page.

Create an XML Page

When creating the page make sure you set the "Uses template" field to (blank) and then on the "Page Settings" tab make sure the following settings are selected:

  • Container? No
  • Rich Text? No
  • Searchable No
  • Cacheable No
  • Empty Cache? Yes
  • Content Type text/xml - This is probably the most important thing to remember

Snippet Calls

Place a call to the Ditto Snippet on the XML document page that you just created.

NB: "&parents" (formerly &startID) in the Ditto call is the page ID of the folder whose contents you wish to index. On my own website I have a folder called "news" with "ID=56" so the call I use is shown below.

[[Ditto?
&parents=`56`
&format=`rss`
&summarize=`20`
&total=`20`
&commentschunk=`Comments`
]]

If you want to have more than one RSS Source just comma separate the parent ids like this:

[[Ditto?
&parents=`56, 7, 10, 15`
&format=`rss`
&summarize=`20`
&total=`20`
&commentschunk=`Comments`
]]

Also try using the "&tpl" parameter to specify the chunk used to format each RSS item, e.g.

[[Ditto?
&parents=`95`
&format=`rss`
&summarize=`20`
&total=`20`
&tpl=`rss_item_simple`
]]

If you want to summarize "ALL" posts in your site, any page that is published and appears in the menu, use a parent of "0", and be sure to include the depth and "showInMenuOnly" parameters. The call looks like this:

[[Ditto?
&parents=`0`
&format=`rss`
&summarize=`20`
&total=`20`
&showInMenuOnly=`1`
&depth=`0`
&tpl=`rss_item`
]]

The rss_item chunk looks like this:

<item>
  <title>[+rss_pagetitle+]</title>
  <link>[(site_url)][~[+id+]~]</link>
  <description><![CDATA[ [+introtext+] ]]></description>
  <pubDate>[+rss_date+]</pubDate>
  <guid isPermaLink="false">[(site_url)][~[+id+]~]</guid>
</item>

Reference the Feed in your Document Head

Then to have your rss automatically detected by your site visitors, add the following in the header of your HTML template:

<link rel="alternate" type="application/rss+xml" title="Whatever you need" href="url_of_the_above_page_with_ditto_rss_call">

Or use the "[~id~]" notation:

<link rel="alternate" type="application/rss+xml" title="[(site_name)] RSS feed" href="[~123~]">

Suggest an edit to this page.