Markdown
A Markdown file is a module. A page imports it and renders it as a component. A page can also be a Markdown file itself.
Markdown pages
A +page.md is rendered inside the layouts like any other page. It cannot
write %title or %meta, so its front matter fills in <head>:
---
title: About
---
# About
This page is `src/routes/about/+page.md`.
| Field | Element |
|---|---|
title | <title> and og:title |
description | the description and og:description |
image | og:image |
image is resolved like an import() in that file: ./card.png is next to
the page, and /card.png is in the source directory. The tag gets the
absolute URL of the hashed asset, so image needs a :url in src/site.rb.
A Markdown page cannot define self.static_params, so it cannot be a route
with params. For a page per Markdown file, import the files into a Haml page,
as in Dynamic routes.
Front matter
A file can start with a YAML block between --- lines:
---
slug: introducing-rista
title: Introducing Rista
date: 2026-11-03
tags: [meta]
---
Rista is a static site generator for Ruby.
The front matter is the Frontmatter constant of the imported module, a hash
with symbol keys. A date is an ISO 8601 string such as "2026-11-03".
Rista reads three fields of a +page.md: title, description and image.
Everything else is for the site’s own pages.
Rendering
:ruby
Post = import("./_posts/introducing-rista.md")
%h1= Post::Frontmatter.fetch(:title)
= Rista::H[Post]
To get the HTML as a string, for a feed, use
Rista::Renderer.render(Rista::H[Post]).
Many files
import_glob returns a hash of path to module. This site sorts its posts
once, in a module that every page imports:
# src/posts.rb
POSTS = import_glob("./routes/blog/_posts/*.md").values.sort_by { it::Frontmatter.fetch(:date) }.freeze
module Default
def self.all = POSTS
end
Syntax
Markdown is parsed by Kramdown with its GitHub-flavoured parser. Tables, fenced code blocks and inline HTML work.
A fenced code block with a language gets a class, such as
<code class="language-ruby">. There is no syntax highlighting.
Styling
Markdown output has no scoped classes. Style it from the page that renders
it, with :global. See Styling.