Yep, no {{ghost_head}}

Replacing the {{ghost_head}} helper for fun(?!) and profit(?) on Ghost 4.x.

Yep, no {{ghost_head}}

Interesting week for coding! I had a client who wanted custom schema on his Ghost site. His Ghost 4.x site. No wait, it gets even worse, his Ghost 4.4 site. Yes, really. I got tired of telling him he should really upgrade and finally just did the work.

Did you know that 4.4 predates the #match helper? And several other quality of life items. And it doesn't have custom variables! And it's just plain quirky in spots. I've gotten really spoiled by late-stage 5.x.

It also didn't help that the client's articles were a mix of posts and pages, that he also used pages as data storage for what were effectively index pages for multiple different topical blogs, that he also used tags as data storage for what were effectively index pages for a different subset of blogs, and there was a mix of articles and podcasts, to boot. I wrote a lot of snarly handlebars, including lots and lots of fallbacks. (The post's description is the excerpt, unless the meta_description is set, in which case use that, but for the facebook description use the facebook_description if it is set, or use the meta otherwise or...)

Interesting job, and it opens up the possibility to change what's happening in {{ghost_head}} to well... anything. I may have to do my 5.x site next.

Take-aways:

  • There's a whole lot of conditional logic buried in {{ghost_head}}!
  • I made the mistake of thinking my dev setup could be 4.48. That was a mistake, and I eventually had to downgrade my Ghost version further (including running Node 14) so that I could more-reliably produce an acceptable dialect of ancient Ghost handlebars.
  • Connecting VS Code my WSL container running Ubuntu 18 caused VS Code to declare it unsupported, so that Copilot didn't work. I missed my auto-complete and my github actions.
  • Does Copilot easily generate valid schema and other boilerplate (when liberally sprinkled with handlebars)? I didn't get to find out this week.
  • There are things I like about the newer 5.x UI, and things I don't, compared to 4.4. Installing a theme is easier. Adding a feature image is MUCH less obvious. Mostly I just kept scratching my head and wondering if the functionality was missing from 4.4, or if I just didn't know where to look.

That's all for today! I'm still several days behind, but didn't want to let another week go by without something... even if short. :)