Templates
Page
page.twig
The page.twig template renders a static content page — such as “About”, “Impressum”, or “Contact”.
Each page is defined by a Markdown file and a matching YAML metadata file under the /userdata/content/page/ directory.
What it does
- Displays a single static page from
/p/{slug} - Renders title, content (from Markdown), and optional cover image
- Uses the same global Twig data (
title,settings,theme,navItems, etc.) - Hides unpublished pages (returns 404 if
is_published: false) - Can be extended with custom fields (buttons, subtitles, meta info)
Available Twig Variables
The template receives a variable called page, representing the current static page.
page – Static page object
| Variable | Type | Description |
|---|---|---|
| page.slug | string | Slug used in the URL (e.g. /p/about) |
| page.title | string | Title of the page (from YAML page.title) |
| page.content | string | HTML body content converted from Markdown |
| page.cover | string | (optional) Cached cover image URL |
| page.is_published | bool | Visibility flag — only true will be shown |
| page.description | string | (optional) Short text or summary (if defined) |
| page.subtitle | string | (optional) Subtitle field (custom YAML key) |
| page.date | string | (optional) Publication or edit date |
| page.author | string | (optional) Author name or credit line |
| page.meta | array | (optional) Any additional metadata defined in YAML |
Note:
Thepageobject is built from two files:
- YAML:
/userdata/content/page/{slug}/{slug}.yml- Markdown:
/userdata/content/page/{slug}/{slug}.md
Example Twig usage
<article class="page-content prose max-w-none"> {% if page.cover %} <img src="{{ page.cover }}" alt="{{ page.title }}" class="rounded-lg shadow mb-6 w-full h-auto" /> {% endif %} <h1 class="text-3xl font-bold mb-4">{{ page.title }}</h1>
{% if page.subtitle %}
<h2 class="text-lg text-gray-600 mb-4">{{ page.subtitle }}</h2>
{% endif %}
{% if page.date %}
<p class="text-sm text-gray-500 mb-4">
Updated: {{ page.date|date("d.m.Y") }}
</p>
{% endif %}
<div class="content"> {{ page.content|raw }} </div>
{% if page.author %}
<p class="text-xs text-gray-400 mt-8">Written by {{ page.author }}</p>
{% endif %}
</article> ```
- Previous
- Blog Posts
- Next
- Timeline