From 904fd887143b1a6f4cdcf5e7a2d45b4bf600ba19 Mon Sep 17 00:00:00 2001 From: Julian Elve Date: Tue, 24 Sep 2019 13:44:48 +0100 Subject: [PATCH] fix: Hugo v0.58.0 breaks RSS template In Hugo v0.58, Hugo team made a breaking change to fix .Data.Pages to actually show home pages when on homepage. Previously, the function returned all of the site's pages. Hence this PR adds compatibility for RSS feeds in Hugo v0.58.0+. Fix #1355 --- layouts/_default/rss.xml | 3 ++- netlify.toml | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/layouts/_default/rss.xml b/layouts/_default/rss.xml index b64752bb..38086bca 100644 --- a/layouts/_default/rss.xml +++ b/layouts/_default/rss.xml @@ -1,6 +1,7 @@ {{- /* Generate RSS v2 with full page content. */ -}} {{- /* Upstream Hugo bug - RSS dates can be in future: https://github.com/gohugoio/hugo/issues/3918 */ -}} -{{- $pages := .Data.Pages -}} +{{- $page_context := cond .IsHome site . -}} +{{- $pages := $page_context.RegularPages -}} {{- $limit := site.Config.Services.RSS.Limit -}} {{- if ge $limit 1 -}} {{- $pages = $pages | first $limit -}} diff --git a/netlify.toml b/netlify.toml index 682ae78f..0626c811 100644 --- a/netlify.toml +++ b/netlify.toml @@ -5,7 +5,7 @@ [build.environment] HUGO_THEME = "repo" - HUGO_VERSION = "0.58.1" + HUGO_VERSION = "0.58.3" HUGO_ENABLEGITINFO = "true" [context.production.environment]