Rista

How this site is built

The timber frame of a house under construction, against a blue sky.

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 in docs/ 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.xml is the return value of src/routes/feed.xml/+route.rb.
  • sitemap.xml is written by the build, from the url in src/site.rb.
  • 404.html is src/routes/+not-found.haml.
  • robots.txt is copied from public/.

Serving it

rista nginx prints the config for the built files. example/Dockerfile builds the site and puts both into an nginx image.