How this site is built

This site is the example/ directory of the Rista repository. Its test is
also the gem’s integration test, so every feature described in the
documentation is used here.
Four kinds of page
- The front page is one Haml file,
src/routes/+page.haml. - The documentation is a set of Markdown files in
src/routes/docs/_pages. One route,docs/[slug], renders them. A layout indocs/adds the list of pages beside each one. - The about page is a Markdown file that is a page itself,
src/routes/about/+page.md. - The blog is a set of Markdown files in
src/routes/blog/_posts, served at dated paths such as/blog/2026/12/01/how-this-site-is-built.
One module per kind of content
src/posts.rb loads every post and answers every question about them:
POSTS = import_glob("./routes/blog/_posts/*.md").values.sort_by { it::Frontmatter.fetch(:date) }.freeze
module Default
def self.all = POSTS
def self.tags = POSTS.flat_map { tags_of(it) }.uniq.sort
end
The post page, the archives, the tag pages and the feed all import it, so
sorting and grouping live in one place. src/docs.rb does the same for the
documentation.
None of this is gem code. Tags, date archives, cover images, the pages of the blog index and the previous and next links are routes and one shared module.
Files that are not pages
feed.xmlis the return value ofsrc/routes/feed.xml/+route.rb.sitemap.xmlis written by the build, from theurlinsrc/site.rb.404.htmlissrc/routes/+not-found.haml.robots.txtis copied frompublic/.
Serving it
rista nginx prints the config for the built files. example/Dockerfile
builds the site and puts both into an nginx image.