From a8d503f14a197564b8cb1db8b2d345f353a97cf1 Mon Sep 17 00:00:00 2001 From: Richard Dern Date: Tue, 1 Apr 2025 14:39:14 +0200 Subject: [PATCH] Fixed Hugo's crappy default RSS template --- themes/default/layouts/_default/index.rss.xml | 24 +++++++------------ 1 file changed, 9 insertions(+), 15 deletions(-) diff --git a/themes/default/layouts/_default/index.rss.xml b/themes/default/layouts/_default/index.rss.xml index 40b32719..76f5a8ac 100644 --- a/themes/default/layouts/_default/index.rss.xml +++ b/themes/default/layouts/_default/index.rss.xml @@ -1,34 +1,28 @@ {{- $authorEmail := "" }} -{{- with site.Params.author }} - {{- if reflect.IsMap . }} - {{- with .email }} - {{- $authorEmail = . }} - {{- end }} - {{- end }} -{{- end }} - {{- $authorName := "" }} {{- with site.Params.author }} {{- if reflect.IsMap . }} - {{- with .name }} - {{- $authorName = . }} - {{- end }} + {{- with .email }}{{- $authorEmail = . }}{{- end }} + {{- with .name }}{{- $authorName = . }}{{- end }} {{- else }} - {{- $authorName = . }} + {{- $authorName = . }} {{- end }} {{- end }} {{- $pctx := . }} {{- if .IsHome }}{{ $pctx = .Site }}{{ end }} + {{- $pages := slice }} {{- if or $.IsHome $.IsSection }} -{{- $pages = $pctx.RegularPages }} + {{- $pages = $pctx.RegularPages }} {{- else }} -{{- $pages = $pctx.Pages }} + {{- $pages = $pctx.Pages }} {{- end }} + +{{- $pages = $pages.ByLastmod.Reverse }} {{- $limit := .Site.Config.Services.RSS.Limit }} {{- if ge $limit 1 }} -{{- $pages = $pages | first $limit }} + {{- $pages = first $limit $pages }} {{- end }} {{- printf "" | safeHTML }}