What is the standard way to make page bundle images show up in a full text RSS feed?

I’m using the built in figure shortcode to insert images into pages as well as some partials that use img tag. This works as expected for the website, but breaks for Page Bundles in full text RSS feeds.

For example, the following post renders images in browser as expected: https://extralongdivision.com/articles/my-enpoopified-experience-at-fifas-world-cup/ . Here’s the corresponding RSS feed template: https://codeberg.org/extralongdivision/extralongdivision-site/src/branch/main/layouts/rss.xml You’ll see from examining the repo that I use relative paths as the src for the images, which the RSS feed in turn uses. I suspect it is the relative src paths that are causing me trouble. The relative paths make it easier to develop the site locally before deploying, so I’d like to keep using them. I hoped using the figure shortcode would auto-magically take care of everything for me, but perhaps that is not the case.

I’ve dug through several years of forum posts and it seems there are many different solutions to this. The most elegant was a comment about adding xml:base to my RSS template (I would link to it but a new user can only post 2 links).

This did not fix the issue for me, unfortunately. The most recent solution I can find is a 3 year old snippet of a render hook (again I would link to the author but I have expended my 2 links).

{{/* Make sure to always use absolute image URLs in RSS feeds. */}}
{{- $srcUrl := "" -}}
{{- if or (hasPrefix .Destination "http://") (hasPrefix .Destination "https://") -}}
  {{ $srcUrl = .Destination }}
{{- else if hasPrefix .Destination "/" -}}
  {{ $srcUrl = absURL .Destination }}
{{- else -}}
  {{ $imageResource := .Page.Resources.Get .Destination }}
  {{- if $imageResource -}}
    {{ $srcUrl = $imageResource.Permalink }}
  {{- else -}}
    {{ $srcUrl = ref .Page .Destination }}
  {{- end -}}
{{- end -}}
<img src="{{ $srcUrl | safeURL }}" alt="{{ .Text }}" {{ with .Title }}title="{{ . }}"{{ end }}>

In the 3 years since have Hugo users reached consensus on best practice to put images in a full text RSS feed? Please do share :slight_smile:

No, you are using the figure shortcode provided by the theme:
https://github.com/adityatelange/hugo-PaperMod/blob/master/layouts/_shortcodes/figure.html

That is quite different than the embedded (built in) figure shortcode:
https://github.com/gohugoio/hugo/blob/master/tpl/tplimpl/embedded/templates/_shortcodes/figure.html

I suggest you override the theme’s figure shortcode as described at the top of this page:
https://gohugo.io/shortcodes/figure

Everything is working swimmingly now. Thank you.