Every File that is rendered within Reptar is passed through the nunjucks template engine. Nunjucks is a full-featured template engine.

You should read the nunjucks documentation to learn how to write a template. Or you can use reptar init to create an initial scaffold of a working template layout.

Configure template location

You configure the location of your nunjucks templates in your reptar.config.js file.

module.exports = {
  path: {
    templates: './_templates'

Built-in filters

In addition to the filters built-in to nunjucks, Reptar ships with a few additional built-in filters to make writing templates easier.

Find the source for built-in filters in the GitHub repo.

date(date, template)

This allows you to easily make use of the momentjs library within a template. It takes a date to format and then a moment template string that it passes through to momentjs:

The year this site was published is: {{reptar.time | date('YYYY')}}.


Passes the string given to Url.slug which in turn passes the string to node-slug.

<a href="{{file.url | slug}}">Find the post here.</a>

absolute_url(relativePath, basePath)

This is useful when constructing URLs in your template and you want to make sure a full URL is outputted.

<a href="{{file.url | absolute_url(site.url)}}">Home</a>