Templating

MarkdownSPA uses tera, allowing you to create a base template for all generated pages:

VariableAvailable inDescription
{{ uri }}Base and nav templatesURI of the page
{{ meta }}Base and nav templatesMapping of the page’s attributes
{{ base_url }}Base and nav templatesEither / or prod_url
{{ page_content }}Base templateHTML content of each markdown file

Extra meta attributes must be written at the top of each markdown file:

[title]:   # (This is a title)
[summary]: # (This is a description)

This is the actual content of the rendered page.

Then, in the base template, those attributes will be accessible through the meta variable:

<div id="app">
    <h1>{{ meta.title }}</h1>
    <details>
        <summary>{{ meta.summary }}</summary>
        {{ page_content }}
    </details>
</div>

In this specific case, the template will render as:

<div id="app">
    <h1>This is a title</h1>
    <details>
        <summary>This is a description</summary>
        <p>This is the actual content of the rendered page.</p>
    </details>
</div>