The post.hbs
file is an essential part of the Ghost CMS, as it serves as a handlebars template used to present individual blog posts on the website. It contains the necessary code and markup to structure and style each blog post's layout. The typical elements that the post.hbs
file includes the post's title, author, publication date, feature image, and content.
By editing the post.hbs
file, writers can change the ghost default post template look and feel of their blog posts, giving their readers a more personalized and unique writing experience.
Changing the template
To modify your ghost default post template in Ghost, you'll need to edit the post.hbs
file in your theme. If you only make stylistic changes, you can use code injection without altering the theme files option.
In that time if you want to add more elements or change in your post publishing layout then you need to edit the post.hbs
file from the ghost cms admin panel. To do this, download the theme zip, access the post.hbs
file in an editor, and make your desired changes. Finally, re-upload the updated theme to apply your changes.
Adding custom templates
Ghost cms make it super duper easy to create custom post templates when you need to change the style of your articles. For instance, you might want to create a limited series with a unique style or add a sidebar or other useful elements to certain posts. With custom ghost themes, you can change the style that fits your needs, making sure that your blog stands out and keeps people interested.
To create a custom template in Ghost, remember to prefix the template name with "custom-". For example, name the file "custom-animation-episode.hbs
" for an animation episode template. This will help you to apply the custom template to particular blog posts, making your blog more engaging, and attractive.
The custom template file should be created in the theme's root folder. For more detailed instructions on creating custom templates in Ghost, check out the Ghost comprehensive guide.
Set another template as the default
Certain Ghost themes offer multiple post templates, typically with at least four options to choose from. If you want to change your ghost default post template to one of the other designs that come with your premium ghost theme, you can do it simply.
Just remember that custom templates must begin with "custom-" in their file name to differentiate them from the pre-existing templates.
To change your ghost default post template, follow these simple steps:
-
Download your theme files from the Ghost Admin.
-
Rename the current
post.hbs
file to something likecustom-old-default.hbs
, or a more personalized name of your choice. -
Rename the template you want to set as the new default to
post.hbs
. -
Zip the theme directory and re-upload it through Ghost Admin.
Your posts that previously used the 'Default' template should now automatically utilize your newly selected ghost template.
To Sum Up
Changing your ghost default post template is a simple process that involves accessing your theme's post.hbs
file, making the necessary changes, and re-uploading the theme directory. Custom templates can also be created to achieve unique designs for specific posts or series. With these easy steps, you can personalize your Ghost theme and improve your website's overall performance.