Lists, tags and the feed

siv lists your pages for you: on the front page, on the list of all pages, on tag pages and in the feed. When you add a page, every list gets it.

The front page # ↑

The starter's front page lists the pages, newest first, each with its title, date and summary. The summary is the first paragraph, or the text above a <!--more--> line.

The front page is content/index.md. The text in it is shown above the list:

+++
title = "My website"
template = "list.html"
+++

Welcome. I write here about what I'm working on and learning.

template = "list.html" makes the page a list. Any folder's page can be one: content/blog/index.md with template = "list.html" lists the pages in content/blog/.

To leave a page out of the lists, but still publish it:

listed = false

All pages # ↑

/all/ lists every page of the site, by date. The starter links to it from the footer of every page.

Tags # ↑

Give a page tags in its front matter:

tags = ["boats", "repair"]

Tag pages are made by one page with for-each. The kitchen-sink starter has one: siv init my-test --starter kitchen-sink.

+++
title = "Tags"
template = "tags.html"
for-each = "tags"
listed = false
+++

This page in content/tags/index.md makes /tags/, listing every tag, and a page for each tag, like /tags/boats/, listing its pages.

The tag page of the kitchen-sink starter: every tag, and how many pages have it
The tag page of the kitchen-sink starter: every tag, and how many pages have it

The template tags.html decides what they show. Pages with many tags in common can be listed with page.related(), and long lists split over several pages with paginate(): siv help tags.

The feed # ↑

Feed readers check a site's feed to see new pages. siv makes an Atom feed at /feed.xml, with the 20 newest pages. The feed needs the address of your site, as feeds use full addresses:

$ siv config base-url https://example.com/
$ siv config timezone Europe/Helsinki

Without the address, the build skips the feed and tells you so. The time zone makes the times right in feed readers.

Drafts, unlisted pages and pages without a date are left out of the feed. To leave out one page, add in-feed = false.

The feed is made by the template content/feed.xml. To send only the summaries, change p.content to p.summary in it. Details: siv help feed.

With the address set, siv also writes /sitemap.xml for search engines.

Pages in other languages # ↑

Set the site's language, and a page's own language in its front matter:

$ siv config lang en
+++
title = "Sauna"
lang = "fi"
+++

Browsers, screen readers and translators use it: a screen reader reads a Finnish page with a Finnish voice.

A page in two languages has a file for each, in the same folder:

content/sauna/index.md        /sauna/       the main version
content/sauna/index.fi.md     /sauna/fi/    in Finnish

siv can also detect the language of each page from its text: siv help languages.

Next: Changing the look