How add meta description for posts - without modifying ghost_head?

I have question regarding tag:

<meta name="description" content="......................." />

How can I add such meta tag for posts without editing ghost_head like mentioned here:

https://forum.ghost.org/t/how-add-meta-description-for-posts/3091/4

I’ve tried by adding to default.hbs:

<meta name="description" content="{{custom_excerpt}}" />

different variants like:

  • excerpt
  • meta_description

without success.

Note: I’ve checked many topics and issues like:

  • github com/TryGhost/Ghost/issues/4424
  • forum ghost org/t/how-to-overwrite-article-schema-with-recipe-schema-markup/8583/2
  • ghost org docs/themes/helpers/meta_data/#description

Details

And

  • How to install Ghost on Ubuntu - following the instruction
  • Node version - the recommended one for 4.8.4, MYSQL, Ubuntu 20.04
  • What errors or information do you see in the console? - no errors
  • What steps could someone else take to reproduce the issue you’re having? - no errors

You could add it in the default.hbs using {{excerpt}} or {{custom_excerpt}}, but to access these properties you have to be in post context:

{{#post}}<meta name="description" content="{{excerpt}}" />{{/post}}
1 Like

Thanks bironthemes

I didn’t know about this detail

1 Like

Could you explain why you’re trying to make this change? The meta description should automatically be set to the custom excerpt if one is set. Duplicating the description doesn’t seem like a great idea.

Hi @Hannah,

Sure.

After a SEO audit - this was one of the important errors.
My idea was to clean the errors in order to see if the result will change.
I know that meta description has low impact on SEO in general.

I was trying to fix the problem in different ways:

  • first by using the custom excerpt - by adding a custom excerpt I expected to have a meta description. This was not the case. Maybe the reason was the custom theme which I was using at that time.

  • I’ve searched how can I do it with code injection. I found several results but I was not able to do so.

  • reading the docs about helpers

Finally it wasn’t so important from SEO point of view. It was more related to my curiosity and why I can’t make it work.

I’m using ghost for a long time and I really like it. Most of the time I’m reading the docs and follow the instructions. Very few times there are some small changes on the base docs.

But this time I wasn’t able to complete the task - that’s why I wanted to see if I’m doing something wrong.

Cheers