✨ Flair — a customizable, stylish theme for your blogExplore

How to Change Your Default Post Template in Ghost

Tutorial for changing the default post template in your Ghost theme. Change the existing template, or switch on of the custom ones your theme comes with.

Norbert
Norbert3 min read

In Ghost CMS, the post.hbs file is a handlebars template file that is used to display individual blog posts on the website and contains the code and markup that is used to structure and style the layout of individual blog posts. This usually includes elements such as the post title, author, publication date, feature image and the post content.

Changing the template

If you want to make changes to your default post template, you must edit the post.hbs file of your theme. Of course, if you just want to make stylistic changes, then those can be done from code injection without changing the theme files.

However, if you want to add some new elements or change the layout of the template, then you have to edit the the file. For this you need to download the theme zip. Open the post.hbs file in an editor, make your changes and then reupload the changed theme.

Adding custom templates

At some point, you might want to add a new layout for some of your posts, maybe a limited series with a bespoke style, or some useful element, like a sidebar, etc. Ghost makes it easy to create custom templates for just such occasions.

The most important thing to notice when creating custom templates for ghost is that you have to prefix the template name by custom-. If you want to create a new custom template for your podcast episodes then you can create a new file with the following name custom-podcast-episode.hbs.

This file has to be created in the root folder of the theme.

Here's a detailed guide about creating custom template in Ghost.

Set another template as the default

Some themes come with multiple post template, we usually release theme with at least 4 templates you can choose from. In some cases you might want to change the default template with one of the other ones your theme has.

As mentioned before, the name of the custom template files starts with custom- so you can easily identify the files.

To change the default template follow the steps below:

  • download your theme files from the Ghost Admin
  • rename the post.hbs file to something like custom-old-default.hbs (or something more meaningful for your case)
  • rename the template you want to set as the default one to post.hbs
  • zip the theme directory and re-upload it in Ghost Admin

Your posts that have the 'Default' template selected now should use your new template.

More in Guides & Tutorials

All guides
Ghost Pro Hosting

Get the best managed Ghost CMS hosting and focus on bringing value to your audience.