Skip to content

update RSS layout to fix image rendering#491

Open
apreshill wants to merge 2 commits into
tidyverse:mainfrom
apreshill:fix-rss-img
Open

update RSS layout to fix image rendering#491
apreshill wants to merge 2 commits into
tidyverse:mainfrom
apreshill:fix-rss-img

Conversation

@apreshill

@apreshill apreshill commented Dec 9, 2020

Copy link
Copy Markdown
Contributor

I believe this is ready- the index.xml now contains absolute urls to all images in posts, but the layout still allows relative image links by post authors (respecting page bundling).

current:
https://www.tidyverse.org/blog/index.xml

updated:
https://deploy-preview-491--tidyverse-org.netlify.app/blog/index.xml

h/t to this individual: https://jdheyburn.co.uk/blog/who-goes-blogging-6-three-steps-to-improve-hugos-rss-feeds/

@apreshill apreshill marked this pull request as ready for review December 9, 2020 19:19
<pubDate>{{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</pubDate>
<guid>{{ .Permalink }}</guid>
<description>{{ .Content | html }}</description>
{{- $content := replaceRE "a href=\"(#.*?)\"" (printf "%s%s%s" "a href=\"" .Permalink "$1\"") .Content -}}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you please use a comment here to link back to that blog post that explains how this works?

It's unfortunate that hugo doesn't provide something built in for this case, because the regexp approach is going to be fragile (i.e. it relies on the alt attribute coming after the src attribute).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants