Documentation // ../

  1. Overview
  2. RSS/Atom/JSON
  3. Variable Types
    1. :partials
    2. $collections
    3. @variables
  4. Editing Templates
    1. Assets
    2. Templating Language
  5. Creating Pages
    1. Editing Content
  6. Download
  7. News & Updates
  8. Support
Stacey 2.3
Not backwards compatible

Stacey 3 is not backwards compatible with Stacey 2.3. This website serves as an archive because the old 2.3 documentation was not migrated to the github wiki (that is currently hosting the Stacey 3 documentation).

Now unmaintained, all technical support is now choppy and community led as github issues.

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, if clean urls are enabled, 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.

Cleaning JSON

Stacey will also automatically compress and strip any trailing commas from JSON templates. So, the following template:

get "/" do
{
  "pages": [
    foreach $children do
      { "title": "@title" },
    endforeach
  ]
}
end

will render as:

  {"pages":[{"title":"Projects"},{"title":"About"},{"title":"Contact"}]}