This doc is part of the custom template documentation. You can see all the docs here!

Nunjucks is a templating engine built for Javascript. It helps make template creation and editing really easy! This documentation will include some examples to help you along the way.
You can click the names of the statements to be taken to the official Nunjucks documenation if you need further help.

IF Statement

{% if hungry %}
I am hungry
{% elif tired %}
I am tired
{% else %}
I am good!
{% endif %}


FOR Loop

<h1>Posts</h1>
<ul>
{% for item in items %}
<li>{{ item.title }}</li>
{% else %}
<li>This would display if the 'item' collection were empty</li>
{% endfor %}
</ul>


Reusable Components (Includes)
This lets you include another template file in your page. For example here we've included the footer file on the homepage at the bottom!



Further Nunjucks Documentation is available here.
Was this article helpful?
Cancel
Thank you!