Creating an article template

It is probably worth creating an article template with a custom meta file, contain article-specific elements such as created_at, excerpt, tags (see below), etc.

To create a new template, use the create_template command, like this:

nanoc create_template article

This will create a directory for the article template. Here’s a sample meta file for the article template:

# Built-in

# Custom
kind:       "article"
title:      "__TITLE__"
excerpt:    "__EXCERPT__"
created_at: "<%= Time.now %>"

To create a new blog post, use the create_page command with the --template (or simply -t) option, like this:

nanoc create_page blog/a-new-article --template=article

You’ll have to change the title and excerpt in the meta file. created_at is automatically filled in with the creation time of the page, but this is won’t be the timestamp on which you publish the post, so that’ll need to be changed as well.