reuixiy / hugo-theme-meme

😝 You can’t spell awesome without MemE!
https://io-oi.me/hugo-theme-meme
MIT License
1.01k stars 279 forks source link

Relative links in RSS feed #141

Closed palant closed 4 years ago

palant commented 4 years ago

W3C feed validator objects to the RSS feeds containing relative links: https://validator.w3.org/feed/docs/warning/ContainsRelRef.html. In fact, not all RSS feed readers will be able to correctly resolve those, which is why feed should always use absolute links. I investigated this issue a few weeks ago and it seems that Hugo will only apply the "make links absolute" logic to its own RSS feeds and there is no way to make it do the same for custom output formats.

Here is what my current work-around looks like:

<description>{{ replaceRE ` (href|src)="#` (printf ` $1="%s#` .Permalink) (replaceRE ` (href|src)="/` (printf ` $1="%s` .Site.BaseURL) .Content) | html }}</description>
reuixiy commented 4 years ago

This is correct, but I'm not sure if it's worth it, considering the build time that may increase.

I investigated this issue a few weeks ago and it seems that Hugo will only apply the "make links absolute" logic to its own RSS feeds and there is no way to make it do the same for custom output formats.

This is weird, maybe we should consider it as an upstream issue and submit an issue in Hugo?

palant commented 4 years ago

There we go: https://github.com/gohugoio/hugo/issues/7272

palant commented 4 years ago

This is correct, but I'm not sure if it's worth it, considering the build time that may increase.

That argument should be moot given that build time appears to have dropped by ~25% due to recent changes. :wink:

reuixiy commented 4 years ago

Wow, then we can fix this issue now! Could you create a PR for this?

palant commented 4 years ago

Never mind. I measured this properly for my site now - master vs. v.4.3.1 (the latter required converting the config to TOML and adding utils/icon.html partial). The build times didn't change noticeably, so I guess what I saw was due to changes in my site rather than MemE. In fact, even building a search index on the lunr-search branch only increases the build times by ~2%.

palant commented 4 years ago

On the other hand, removing these two regular expressions didn't change build times either - their impact is too small for me to measure (two RSS files, limit is 10 for both).

reuixiy commented 4 years ago

Yes, I just tested it with my site (one RSS file, 132 posts, no limits), and the impact is still very small.

So it's time to solve this issue now!

palant commented 4 years ago

Pull request is https://github.com/reuixiy/hugo-theme-meme/pull/170.