Ghost is escaping titles in RSS

I have created a custom theme for Ghost. It is working fine for all of the visual elements. I have a problem when generating the RSS feed. I have the following line for each post in my rss.hbs file:

 <title><![CDATA[ {{{title}}} ]]></title>

I’m using triple { and } to insert the raw value. But when generating the feed, Ghost still escapes the title:

<![CDATA[ Here&#x27;s an example title ]]>

Has anyone found a good solution to this? To my understanding, values inside CDATA don’t need to be escaped. When doing so, some feed readers will show the title including the escape code, and not the raw title.

It seems like Ghost needs to restart for this to update. I’m on Ghost Pro so I don’t have access to restart it manually.

Ghost pro doesn’t need to be restarted. When you upload a new copy of your theme, it’ll re-parse the files and be ready to go.

That doesn’t work in my case. The theme is being built on GitHub Actions and uploaded using the Deploy Ghost Theme step. Does that make any change? I just checked the uploaded (and active) theme and it has the {{{title}}} code in there.

That should also work. Activating the theme should cause it to parse the hbs files for any changes.

This is a bit of a head-scratcher. To confirm, could you access the RSS feed in the browser, and verify that you’re seeing the unicode instead of ’ ? (If you’re already doing that, my apologies - I’m hoping to rule out the possibility of an RSS feed viewer bug of some sort…)

Edit: I can confirm that escaping (triple-stash) on title and excerpt has this behavior.

What do you mean with the edit? triple-stash doesn’t work in CDATA?

I’m thinking that {{{title}}} actually is behaving exactly the same as {{title}} - and I don’t think it’s actually an RSS related bug… I think…

I opened a bug report: Quirky triple-stash ({{{ }}} ) behavior with titles · Issue #21472 · TryGhost/Ghost · GitHub

I’m pretty sure I also had the same problem in the generated <title> element on the blog post page. And changing it to {{{title}}} worked there.

That’s probably {{{meta_title}}}, which seems to work fine.

You’re right! It is.

So, try this:

{{{../post.title}}}

As long as you’re in the {{#post}} context. If you aren’t, then just {{post.title}}

Kudos to @hannah for the help with the one. I was confused too! Weirdness results because title is a helper, not a piece of data. Helpers don’t get the special {{{ }}} = don’t escape behavior. However post.title is a piece of data, so the {{{}}} gets respected. Yeah, that sort of makes my head hurt, too!

Thank you very much for your help, Cathy. {{{../post.title}}} and {{{post.title}}} didn’t work for some reason. But {{{meta_title}}} did.