Html site title helper

Dear forum,

I have a question about html site titles in custom pages and did not find an answer in the forum yet.
I have set up a custom page “custom-services.hbs” and linked it to the respective site inside the ghost GUI. So far everything works.

Now I would like to be able to change the title of the website itself (in the casper theme it is just implemented with the helper “{{meta_title}}”). The result should be in the format "TITLE_OF_BLOG | TITLE_OF_POST. {{meta_title}} outputs everytime only the name of my blog (is this maybe a bug? The documentation says, this helper outputs the title of the page/post and I’m 99% sure this was the case with other sites I built in the past). I found the helper {{title}} in the documentation, but this doesn’t output anything.

So my main questions are:

  • which helper can i use to access the specific title of a page or post?
  • does this then also work for pages which have a “custom-xy.hbs” template they are based on?

I’m currently using v 3.0.2 of ghost as a docker image.

Thank you in advance and all the best,

Hi Jonas :wave:. {{meta_title}} outputs the meta title added to the meta information in the post settings. Clicking the cog in the top right hand corner of a post edit view and then clicking “Meta Data” will show this field.

If you want to modify how the title is formed you can use a mixture of helpers, such as the @site helper. You can find more info on it in our docs:

To get the output you’re looking then maybe something like this would work?

{{#is "post"}}
  {{#post}}<title>{{@site.title}} | {{title}}</title>{{/post}}

Note that I’m using the post {{title}} here which bypasses {{meta_title}}. I would recommend experimenting with the meta options in Ghost before making too many edits to the theme itself. Hope this helps!

Hi David,

great, that was the solution!

	{{#is "home"}}
			<title>{{@site.title}} | {{title}}</title>

… worked now for me.

Best regards and thank you,