I’ve successfully customized the homepage rss using the rss guide and a custom route and custom template but I cannot figure out a way to customize the author and tag rss templates.
I’m trying to hide certain tags from my author and tag rss feeds. If there is another way to do this instead of customizing the author and tag rss templates, that would work too.
Hi — I’m bumping this old thread as this is exactly the same problem I’ve ran into now (latest version of Ghost, or 5.82.8).
I can’t work out any way to pass the slug context to a custom RSS feed template for author and tag. I suspect it was omitted from the guide to custom RSS, which only covers the homepage, because it’s not possible?
Or these variants (which ChatGPT thought should work):
data: tag.{slug}
data: tag.[slug]
Maddeningly, even resorting to custom redirects for each tag I link from the main nav didn’t work. The below resulted in /tag/movies/ redirecting to /tag/movies/rss/, which I can’t understand.
Does anyone know whether this is possible? It feels half-done to
customise the home RSS feed to a format that suits, but leave the other default RSS feeds in the default format. (I don’t want to use an external RSS service to achieve this, I’d rather output my own custom XML templates)
Interesting! Even if you can’t set data, can you work out what the slug is, and use a get request to get the data you need? If you do ‘log this’ in the rss-tag template (after starting as ghost run -D , is there any sign of the slug?
It works in the sense that it matches all tag RSS routes, and correctly renders rss-tag.hbs using the movie tag data. However it’s unlikely to be useful as every tag would render the data for “movie”, rather than the tag data specific to the route.
What I can’t figure out is how to access :slug inside the template, either simply as {{slug}} or with a regular tag context based on the slug.
Okay I’ve just resumed testing and this does not in fact work. It does work in terms of how the RSS feed displays, with the custom template and data fixed to the specify tag for all tags.
However, the actual tag template is redirected to the RSS feed as well, the same issue I mentioned happening when I tried to hard-code every redirect.
The way Ghost’s caching works, the tag template did display correctly with this route in place immediately following the update, but a few refreshes or a private tab triggers an update where this undesired redirect takes effect.
I’ll need to read through the Routing docs again, because I have no idea why /tag/:slug/rss/: would match /tag/movies/. If I could get around that I could just hard-code the RSS feed routes for my nav-linked tags.
@floraevista accidentally deleted my first reply trying to edit, update:
I did try with ghost run -D but there was nothing in the log that gave me useful debug info unfortunately.
{{slug}} and {{tag.slug}} output as empty in my custom template whatever syntax I try in the route to pipe it through. And the redirect issue mentioned adds a second problem to what I expected to be a super simple tweak.
I suspect Ghost doesn’t support dynamic data in custom routes, though I can’t see definitive info about this in the docs or highlighting of this limitation.
Another update that might help someone reading this thread later (I can’t make more than 3 consecutive posts, so appending). I found the only solution for the case of custom RSS for tags (though same logic will apply to author RSS feeds) is to make a custom route + custom RSS template for each tag (or author) you want to customise RSS for. In routes, you would add an entry like this for each tag (and the template it references has the tag hard-coded to output the correct data):
This successfully over-writes the default tag RSS at the same default URL, so inelegant but for my case, does what I needed.
Also note the tag/author RSS feeds exist by default but aren’t linked in the HTML (home RSS feed is), so you’d probably want to add something like this to default.hbs above ghost_head so RSS readers pick it up first: