How to create custom templates?

Publii offers possibility to create custom templates for posts, tags, and authors. To create a custom post template, follow these steps:

  1. Create a post-TEMPLATE_SLUG.hbs file,
  2. In the theme's config.json file, please add the following entry:

"postTemplates": {
   "TEMPLATE_SLUG": "Human readable template name"
}

WARNING! Please use lowercase slugs without any special and non-latin chars. Also, avoid using the DEFAULT slug as it is used exclusively for posts which are using the default post template from the post.hbs file.

If custom post templates are available, then a dropdown option will appear under the Advanced settings in the post editor.

Custom author templates

To create a custom author template, follow these steps:

  1. Create a author-TEMPLATE_SLUG.hbs file,
  2. Add the following entry to the theme's config.json file:

"authorTemplates": {
   "TEMPLATE_SLUG": "Human readable template name"
}

If custom author templates are available then the dropdown option will be activated in the tag add/edit form.

Custom tag templates

To create a custom post template, follow these steps:

  1. Create a tag-TEMPLATE_SLUG.hbs file,
  2. Add the following entry to the theme's config.json file:

"tagTemplates": {
   "TEMPLATE_SLUG": "Human readable template name"
}

If custom tag templates are available a dropdown option will be activated in the tag add/edit form.