1

Fixed Hugo's crappy default RSS template

This commit is contained in:
2025-04-01 14:39:14 +02:00
parent 04728136ca
commit a8d503f14a

View File

@@ -1,18 +1,9 @@
{{- $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 = . }}
{{- end }}
@@ -20,15 +11,18 @@
{{- $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 "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"yes\"?>" | safeHTML }}
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">