Custom Macros
You can add new macros through the macros plugin.
To do so, you must provide plugins.macros.path
in your config.toml. It
should point to a directory where you’ll store files with your macros.
config.toml
[plugins.macros]
path = "macros"
Now create macros directory and put there some file, let’s say mymacros.html. You can define a new macro in this file like this:
macros/mymacros.html
{% macro bold(text) -%}
<strong>{{ text }}</strong>
{%- endmacro %}
From now on you can enable bold
macro in your files by importing it,
similar how you’d do it with built-in stag.html:
{% from "mymacros.html" import bold %}
{% from "mymacros.html" import bold with context %}