RSS-specific render hook not working

Hello! I am working on my site’s RSS feed; my site does some fancy image lazy-loading trickery that results in broken-looking content in my feed, so I am trying to add an output format-specific template for both a shortcode I’m using and the render-image hook.

The shortcode seems to be working fine (my feed renders img.rss.html and the HTML pages render img.html), but the render hook always renders HTML. I’ve tried naming it render-image.rss.xml, which is suggested by the docs, as well as most other variations I could think of (e.g. render-image.rss.html) but it always renders the HTML hook.

Expected behavior: in my RSS template (layouts/blog/rss.xml in the repo linked below), all Markdown images should render using render-image.rss.[ext] and not render-image.html.

Actual behavior: render-image.html is always used.

My (messy) code is here:

I can reproduce the problem. It’s a known issue:

Hugo ignores render-heading.rss.xml and render-image.rss.xml.

And just like that @bep has committed a fix. Thanks @jmooring for cross-posting into GitHub and helping to flag this!

1 Like