Templates and layouts

Design one post, page, tag or author on its own

A template for one slug gives a single post, page, tag or author a design of its own, such as an About page with a team photo or a landing page without a sidebar. Every other post or page keeps the default template. Ghost picks the template by the slug, the last part of the address. The slug of https://example.com/about/ is about. In Ghost Admin, the URL field of the post or page settings shows it.

Add the template

  1. Open your project in Fantasma.
  2. In the left sidebar, click + next to Templates. The Add Template menu opens.
  3. Under Variants, the first group of the menu, click Page template. For the others, click Post template, Tag template or Author template instead. A small dialog opens.
The Add Page Template dialog with two fields, Page for specific slug and Page by tag
  1. In the first field, Page for specific slug, enter the slug from Ghost, such as about. For a tag or an author the field is Tag for specific Slug or Author for specific Slug.
  2. Click the arrow button at the end of the field. The template appears under Page in the Templates list, named after its slug, such as /about, and opens on the canvas.

The new template starts as a copy of your current Page template, with all its sections. The right sidebar reads "This template is used automatically when a page has slug "about" in Ghost."

Fantasma turns what you type into a slug. Capital letters become small letters, and spaces become hyphens. If your project already has a template for that slug, Fantasma shows Could not create template.

Your Ghost site shows the template once you publish the theme or upload it again. Publish your theme to Ghost describes both ways.

The Add Template menu lists Recommended pages: About, Contact, Authors, Tags and Recommendations. Each one adds a Page template for that slug, such as /contact for Contact. Contact, Authors, Tags and Recommendations come with their own sections, such as a contact form on Contact or a list of all your tags on Tags. The contact form sends to a form service of yours: select the Form and enter the service's address in URL, as Add a contact form explains. Create a page with the same slug in Ghost Admin, such as tags, for the template to show. Contact, Authors, Tags and Recommendations don't show the text you write in that Ghost page. To show it, add a Post Content section to the template.

Change the slug later

Select the template in the list. In the right sidebar, enter the new slug in Slug. When you change a slug in Ghost, change it here too, or the post or page goes back to the default template.

To remove the template, click Delete template at the bottom of the right sidebar. The post or page goes back to the default template once you publish the theme again.

A template for one slug comes before a template for a tag. Which template Ghost uses for each page explains the whole order.

Was this article helpful?