Absolutify all URLs in a content for full-text RSS-feed?

I currently want to include a fulltext-RSS-feed to my page, and I am currently at an issue where I’m unsure what’s the most elegant solution.

The Problem

I have taken the hugo RSS-template, added a field <content type="html">{{ .Content | html }}</content> to it. However, this field now contains relative URLs to all images and other files linked, that are placed it the appropriate folder next to the markdown, and at least my Feed-Reader is not able to resolve this, so the posts show up without the figures included.

What I tried so far

  • {{ .Content | absURL | html }}, doesn’t change anything
  • {{ .Content | html | absURL }}, doesn't render at all as html` seems to have to be the last part of the chain
  • both of the above with safeHTML instead of HTML
  • canonifyURLs = true, relativeURLs = true and both at the same time

What I currently still try to avoid

  • always writing my own shortcode: ![my image]({{< absolutify "myimage.png" >}}), as it would most likely work, but would be comparatively inconvenient compared to the builtin `my image to always write a shortcode for it.

So I was wondering whether there possibly is an elegant option to tell Hugo to just absolutify all URLs, be it images or links to other material, that I haven’t found yet? Preferrably one that doesn’t require modifications of existing markdown, so that I can just continue writing in normal markdown.

Any ideas are greatly appreciated! :slight_smile:

Don’t care about it, set xml:base in the <rss … > element.
Check https://www.w3.org/TR/xmlbase/


Thank you very much, works like a charm!

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.