Documentation

  1. Back
  2. Overview
  3. Creating Pages
    1. Editing Content
  4. Editing Templates
    1. Templating Language
    2. Assets
  5. Variable Types
    1. @variables
    2. $collections
    3. :partials
  6. RSS/Atom/JSON
  7. Download
    Version 2.0RC3
Stacey2

RSS/Atom/JSON

Stacey doesn’t make too many assumptions about which format your templates are written in. It uses the extension of the template file to work out what type of content it should be serving. By default stacey will recognise and serve the correct content-types for .html, .json, .xml, .atom, .rss, .rdf & .txt files.

In fact, this is how the default RSS feed is built. The /content/feed directory is just a normal stacey page, the only difference is that it uses .atom rather than .html template files.

So, if you wanted to switch out Atom for the RSS2 format, your /templates/feed.atom template could be renamed to feed.rss and changed to look something like this:

<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
  <channel>
    <title>@name's @feed_name</title>
    <link>http://@base_url/@permalink/</link>
    <description>@description</description>

    :feed_loop

  </channel>
</rss>

Additionally, stacey creates file extension shortcuts for all the file types listed above. This means rather than having to point to http://yourdomain.com/feed/, you could shortcut this to http://yourdomain.com/feed.atom.