Templates

Feeds and sub-folders

Give each channel an RSS feed, and host a site anywhere on a domain, not just at the top.

RSS feeds

Each channel in verso.json gets an RSS feed, once the site has a "url". You can set the address in Site settings:

{
  "name": "Northlight",
  "url": "https://northlight.studio",
  "channels": {
    "journal": { "label": "Journal", "template": "post" }
  }
}

A build writes /journal/feed.xml, titled “Journal — Northlight”, with the 30 newest live posts in the folder. Each item has the post's title, address, date, description and tags, and its body rich text field (or its first rich text field) as the full text, with addresses that start with / made absolute. The channel's pages get a <link rel="alternate" type="application/rss+xml"> in their head, so feed readers find it on their own. The editor serves the feed too.

A site in a sub-folder

When a site lives inside a folder of a domain, like example.com/notes/, set the sub-folder in Site settings, or say so in verso.json:

{
  "name": "Field notes",
  "url": "https://example.com",
  "base": "/notes"
}

Templates keep writing addresses from the root, like /journal/ and /elevate.css. The build puts /notes in front of every address that starts at the root, in href, src, srcset, action and poster, on every page, including split lists, tag pages and 404.html. Code samples are left as written. The sitemap and the feeds use the full address, like https://example.com/notes/journal/, and each address in pages.json starts with /notes.

Scripts can't be rewritten, so the built <html> carries the base for them:

const base = document.documentElement.dataset.base || '';
const pages = await (await fetch(`${base}/pages.json`)).json();

The editor always runs at the root, so data-base is only there in a build. Paths inside CSS, like a url() for a font, aren't changed; write those relative to the stylesheet.