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


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">
    <title>@name's @feed_name</title>



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, you could shortcut this to

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" },

will render as: