Meta descriptions missing in Ghost? How to fix.
Why is ahrefs suddenly mad about this site, and other stories.
Ghost mostly provides good default set of meta data, but one of my retainer clients was getting reports that his site's meta description was missing from a bunch of pages. I was scratching my head, because the problem seemed sporadic. Then I found it. Paginated routes don't get a meta description.
If you can edit your theme, here's how you fix it. (If you'd like me to edit your theme to make this change, this is a $100 job. Get in touch.)
In default.hbs, add the block line (right above {{ghost_head}}
):
{{{block "extraMeta"}}}
{{ ghost_head }}
</head>
In index.hbs:
{{#is "paged"}}
{{#if meta_description}}
{{#contentFor "extraMeta"}}<meta name="description" content="{{meta_description}}">
{{/contentFor}}
{{else}}
{{#contentFor "extraMeta"}}<meta name="description" content="{{@site.meta_description}}">
{{/contentFor}}
{{/if}}
{{/is}}
In tag.hbs:
{{#is "paged"}}
{{#if tag.meta_description}}
{{#contentFor "extraMeta"}}<meta name="description" content="{{tag.meta_description}}">
{{/contentFor}}
{{else if tag.description}}
{{#contentFor "extraMeta"}}<meta name="description" content="{{tag.description}}">
{{/contentFor}}
{{else}}
{{#contentFor "extraMeta"}}<meta name="description" content="{{@site.meta_description}}">
{{/contentFor}}
{{/if}}
{{/is}}
In author.hbs
{{#is "paged"}}
{{#author}}
{{#if meta_description}}
{{#contentFor "extraMeta"}}<meta name="description" content="{{meta_description}}">
{{/contentFor}}
{{else if bio}}
{{#contentFor "extraMeta"}}<meta name="description" content="{{bio}}">
{{/contentFor}}
{{else}}
{{#contentFor "extraMeta"}}<meta name="description" content="{{@site.meta_description}}">
{{/contentFor}}
{{/if}}
{{/author}}
{{/is}}
And that's it! We avoid writing out duplicate meta descriptions for non-paginated pages, since Ghost head is doing that correctly, and just target the problem spots.
So did it work? Below is the number of pages with missing meta descriptions on my client's site, including the two scans immediately before and after today's fix:
Yes. Yes it did. (That's a fix on all paginated routes.) Of course, now ahrefs is complaining about some of the descriptions being too short/long, but that's a client problem, not a me problem. :)