diff --git a/content/post/2021/01/hugo-rss-feeds-and-lazy-image-loading.md b/content/post/2021/01/hugo-rss-feeds-and-lazy-image-loading.md new file mode 100644 index 00000000..a4e2809b --- /dev/null +++ b/content/post/2021/01/hugo-rss-feeds-and-lazy-image-loading.md @@ -0,0 +1,85 @@ +--- +title: RSS Feeds, Hugo, and Lazy Image Loading +subtitle: Where's my content? It's a tarp! +date: 2021-01-05 +tags: + - hugo + - rss +categories: + - webdesign +--- + +## Full RSS Content in Hugo + +Just a quick one I wanted to get out there in case you are, like me, using [Hugo](/post/2020/05/hugo-extended/) to power a blog. Apparently, in 2017, the default [behavior changed](https://discourse.gohugo.io/t/full-text-rss-feed/8368/3) from using the `.Content` to the `.Summary` variable in the default [rss.xml](https://github.com/gohugoio/hugo/blob/master/tpl/tplimpl/embedded/templates/_default/rss.xml). + +What's the big deal? I had no idea, until I started using a proper RSS reader today - the open source [NetNewsWire](https://ranchero.com/netnewswire/) for Mac. This is what your RSS feed will look like: + +![](../netnewswire.jpg "My Apple M1 article in an RSS reader. Where's all the text?") + +The above screenshot might mislead you into thinking I simply captured only a part - I did not. That's the `.Summary`, right there. Since reading all "the news" in one place sounds intriguing, and I'd like other visitors to enjoy my _full_ blog posts in these tools too, I'd have to change the default behavior. That can be easily done by copy-pasting the default into `layouts/_default/rss.xml` and altering it to your liking - such as swapping `.Summary` for `.Content`. + +However, that brings us to to problem number two. + +## Lazy loading and RSS Feeds + +Recently, after trying to maximize my [Lighthouse](https://developers.google.com/web/tools/lighthouse/) score, especially on performance levels, I implemented [lazysizes](https://github.com/aFarkas/lazysizes), a simple solution to lazy load `` tags, thereby reducing the critical path for a single page to load. That requires a custom `render-image.html` (only available when using the Goldmark Markdown renderer) in `_default/_markup/` that looks like this: + +```html +
+ + + {{ . }} + + {{ with .Title }} +
{{ . }}
+ {{ end }} +
+``` + +Do not forget the `