From eb36804cec95135f72ca47f8d2bfb29416501082 Mon Sep 17 00:00:00 2001 From: Nantha Sorubakanthan Date: Tue, 11 Nov 2025 10:23:38 +0100 Subject: update rss layout took rss from zacoons/zacoons.com on codeberg --- layouts/index.xml | 70 ++++++++++++++++++++++++++++++++----------------------- 1 file changed, 41 insertions(+), 29 deletions(-) (limited to 'layouts/index.xml') diff --git a/layouts/index.xml b/layouts/index.xml index db5dd5c..0310854 100644 --- a/layouts/index.xml +++ b/layouts/index.xml @@ -1,33 +1,45 @@ -{{- $authorEmail := .Site.Params.email }} -{{- $authorName := .Site.Params.name }} +{{- $authorName := site.Params.author.email }} +{{- $authorEmail := site.Params.author.name }} + {{- $pctx := . }} {{- if .IsHome }}{{ $pctx = .Site }}{{ end }} -{{- $pages := where .Site.RegularPages "Params.index" true }} -{{- printf "" | safeHTML }} +{{- $pages := slice }} +{{- if or $.IsHome $.IsSection }} +{{- $pages = where $pctx.RegularPages "Section" "blog" }} +{{- else }} +{{- $pages = where $pctx.Pages "Section" "blog" }} +{{- end }} +{{- $limit := .Site.Config.Services.RSS.Limit }} +{{- if ge $limit 1 }} +{{- $pages = $pages | first $limit }} +{{- end }} +{{- printf "" | safeHTML }} - - {{ if eq .Title .Site.Title }}{{ .Site.Title }}{{ else }}{{ with .Title }}{{ . }} on {{ end }}{{ .Site.Title }}{{ end }} - {{ .Permalink }} - {{ .Site.Title }} - {{ $authorEmail }} ({{ $authorName }}) - Hugo - {{ site.Language.LanguageCode }}{{ with $authorEmail }} - {{.}}{{ with $authorName }} ({{ . }}){{ end }}{{ end }}{{ with $authorEmail }} - {{ . }}{{ with $authorName }} ({{ . }}){{ end }}{{ end }} - {{- with .OutputFormats.Get "RSS" }} - {{ printf "" .Permalink .MediaType | safeHTML }} - {{- end }} - {{- range $pages }} - - {{ .Title }}{{ $title := .Title }} - {{ .Permalink }} - {{ .PublishDate.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }} - {{- with $authorEmail }}{{ . }}{{ with $authorName }} ({{ . }}){{ end }}{{ end }} - {{ .Permalink }} - {{- $emailprompt := "" }} - {{- with .Site.Params.links.email }}{{ $emailprompt = printf "← Reply-To" . $title }}{{ end }} - {{ ((printf "%s%s" .Content $emailprompt) | transform.XMLEscape) | safeHTML }} - - {{- end }} - + + {{ if eq .Title .Site.Title }}{{ .Site.Title }}{{ else }}{{ with .Title }}{{ . }} on {{ + end }}{{ .Site.Title }}{{ end }} + {{ .Permalink }} + Recent content + {{ if ne .Title .Site.Title }}{{ with .Title }}in {{ . }} {{ end }}{{ end }}on {{ .Site.Title }} + + Hugo + {{ site.Language.LanguageCode }}{{ with $authorEmail }} {{.}}{{ + with $authorName }} ({{ . }}){{ end }}{{ end }}{{ with $authorEmail }} {{ + . }}{{ with $authorName }} ({{ . }}){{ end }}{{ end }}{{ with .Site.Copyright }} {{ + . }}{{ end }}{{ if not .Date.IsZero }} {{ (index + $pages.ByLastmod.Reverse 0).Lastmod.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}{{ + end }} {{- with .OutputFormats.Get "RSS" }} {{ printf "" + .Permalink .MediaType | safeHTML }} {{- end }} {{- range $pages }} + {{ .Title }} + {{ .Permalink }} + + {{ .PublishDate.Format "Mon,02 Jan 2006 15:04:05 -0700" | safeHTML }} + {{- + with $authorEmail }}{{ . + }}{{ + with $authorName }} ({{ . }}){{ end }}{{ end }} {{ .Permalink }} + {{ + .Content | transform.XMLEscape | safeHTML }} + {{- end }} + -- cgit v1.2.3