Life without {{ghost_head}}: A somewhat strange blog post

New and somewhat strange blog post, in which I speculate about what it’d take to replace {{ghost_head}} with custom code.

Why would you want to do this? Because it’d let you load a custom version of Portal/Search/Comments even on Ghost Pro.

Why wouldn’t you want to do this yet? Because we’re short a few handlebars helpers of it being an easy drop-in replacement.

2 Likes

The post is not strange at all. I wanted to make similar one recently.
Re-creation of {{ghost_head}} seems to be only way for Ghost(Pro) users to load custom Portal, or Search. I would appreciate some way to edit it without re-doing it from scratch.

Thank you for research Cathy.

2 Likes

Thanks for the feedback! :)

I think the biggest limitation/nuisance would be the loss of code injection. Everything else wouldn’t change often, or could probably be dealt with. (Is a schema invalid if it doesn’t specify image sizes??) But if a site is basically static** in terms of layout changes and is just getting new blog posts added, then maybe it’d be OK.

**Does this happen? I’ve never had a site that was not under active development/tweaking, but surely it must happen to some people, right?

1 Like

I agree Cathy, it looks like we can’t just get image sizes. Which should not be big deal.

I’ve tried output all code injection in my local install and I found global one under @site.

{{{@site.codeinjection_foot}}}
{{{@site.codeinjection_head}}}

So I wonder why I see them and you don’t, maybe different version of Ghost? Anyway even if something would miss, small requests for changes comes from clients often so we might hard-code various things into default.hbs if needed, or we can instruct clients how to do that on their own.

Anyway thank you for valuable article I guess I will need to read it in near future again. :smiling_face:

2 Likes

Thank you! I was confused by not seeing code injection under @site also! I’ll investigate and update. :slight_smile:
Update: Yep, it’s available under @site, it’s just missing from the documentation. Paging @RyanF - the documentation for @site is missing @codeinjection_head and _foot … and several other keys. :slight_smile:

2 Likes

I updated the docs: Ghost Handlebars Theme Helpers: @site

2 Likes

Thanks. There’s one more typo:

“UURL specified for this site in your custom config file“

Also, there should be an option to remove this line:

It’s a security risk. Automated scanners can find vulnerable versions of ghost in bulk as long as this header is present, and then exploit them all at once.

It’s a security best practice to do not advertise what version of software you’re running, unless you need to.

Until it’s an option that’s one more reason to replace ghost_head in a template.

5 Likes