Templates
Blog Posts
post.twig
The post.twig template renders a single blog post page.
It displays the post’s title, content (converted from Markdown), and optionally a cover image, tags, and metadata like the publication date.
What it does
- Renders a full single blog post (based on the
/blog/{slug}route) - Displays the post’s title, HTML content, and optional cover image
- Supports optional metadata (tags, publication date, etc.)
- Hides unpublished posts (they result in a 404 page)
- Uses the same Twig context structure as other Minniark templates
Available Twig Variables
The template receives a variable called post representing the current blog post.
post – Single blog post object
| Variable | Type | Description |
|---|---|---|
| post.slug | string | The unique slug used for the post URL (e.g. my-first-post) |
| post.title | string | Title of the post (from YAML, or falls back to slug) |
| post.content | string | HTML content converted from the Markdown file |
| post.cover | string | (optional) Cached cover image URL (via get_cacheimage()) |
| post.is_published | bool | Indicates if the post is visible (false → 404) |
| post.tags | array | (optional) List of tag strings |
| post.published_at | string | (optional) Publication date (e.g., 2025-10-08) |
| post.author | string | (optional) Author name if included in YAML |
| post.excerpt | string | (optional) Short description or intro text |
| post.url | string | The canonical URL for the post (/blog/{slug}) |
Note:
All fields come from the.ymlfront matter (essaykey) of the post folder
(userdata/content/essay/{slug}/{slug}.yml).
Thepost.contentfield is automatically generated by parsing the associated Markdown file.
Example Twig usage
<h2>{{ post.title }}</h2>
<p><small>{{ post.created_at }}</small></p>
<article>
{{ post.content|raw }}
{% if post.tags is defined and post.tags is not empty %}
<ul class="tags">
{% for tag in post.tags %}
<li class="tag">{{ tag }}</li>
{% endfor %}
</ul>
{% endif %}
</article>