From 15e3dedcee1d0830871ffc692143318a87646101 Mon Sep 17 00:00:00 2001 From: Christian Segundo Date: Thu, 25 Jul 2024 02:12:22 +0200 Subject: wip --- layouts/_default/rss.xml | 82 +++++++++++++++++++++++++ layouts/partials/footer.html | 139 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 221 insertions(+) create mode 100644 layouts/_default/rss.xml create mode 100644 layouts/partials/footer.html (limited to 'layouts') diff --git a/layouts/_default/rss.xml b/layouts/_default/rss.xml new file mode 100644 index 0000000..df3173b --- /dev/null +++ b/layouts/_default/rss.xml @@ -0,0 +1,82 @@ +{{- /* Same as https://github.com/adityatelange/hugo-PaperMod/blob/master/layouts/_default/rss.xml but without Hugo branding */}} +{{- $authorEmail := "" }} +{{- with site.Params.author }} + {{- if reflect.IsMap . }} + {{- with .email }} + {{- $authorEmail = . }} + {{- end }} + {{- end }} +{{- else }} + {{- with site.Author.email }} + {{- $authorEmail = . }} + {{- warnf "The author key in site configuration is deprecated. Use params.author.email instead." }} + {{- end }} +{{- end }} + +{{- /* Deprecate site.Author.name in favor of site.Params.author.name */}} +{{- $authorName := "" }} +{{- with site.Params.author }} + {{- if reflect.IsMap . }} + {{- with .name }} + {{- $authorName = . }} + {{- end }} + {{- else }} + {{- $authorName = . }} + {{- end }} +{{- else }} + {{- with site.Author.name }} + {{- $authorName = . }} + {{- warnf "The author key in site configuration is deprecated. Use params.author.name instead." }} + {{- end }} +{{- end }} + +{{- $pctx := . }} +{{- if .IsHome }}{{ $pctx = site }}{{ end }} +{{- $pages := slice }} +{{- if or $.IsHome $.IsSection }} +{{- $pages = $pctx.RegularPages }} +{{- else }} +{{- $pages = $pctx.Pages }} +{{- 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 }} + Recent content {{ if ne .Title site.Title }}{{ with .Title }}in {{ . }} {{ end }}{{ end }}on {{ site.Title }} + {{- with site.Params.images }} + + {{ site.Title }} + {{ index . 0 | absURL }} + {{ index . 0 | absURL }} + + {{- end }} + {{ site.Language.LanguageCode }}{{ with $authorEmail }} + {{.}}{{ with $authorName }} ({{ . }}){{ end }}{{ end }}{{ with $authorEmail }} + {{ . }}{{ with $authorName }} ({{ . }}){{ end }}{{ end }}{{ with site.Copyright }} + {{ . | markdownify | plainify | strings.TrimPrefix "© " }}{{ 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 }} + {{- if and (ne .Layout `search`) (ne .Layout `archives`) }} + + {{ .Title }} + {{ .Permalink }} + {{ .PublishDate.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }} + {{- with $authorEmail }}{{ . }}{{ with $authorName }} ({{ . }}){{ end }}{{ end }} + {{ .Permalink }} + {{ with .Description | html }}{{ . }}{{ else }}{{ .Summary | html }}{{ end -}} + {{- if and site.Params.ShowFullTextinRSS .Content }} + {{ (printf "" .Content) | safeHTML }} + {{- end }} + + {{- end }} + {{- end }} + + diff --git a/layouts/partials/footer.html b/layouts/partials/footer.html new file mode 100644 index 0000000..7574cb2 --- /dev/null +++ b/layouts/partials/footer.html @@ -0,0 +1,139 @@ +{{- /* Same as https://github.com/adityatelange/hugo-PaperMod/blob/master/layouts/partials/footer.html but without Hugo and theme branding */}} +{{- if not (.Param "hideFooter") }} + +{{- end }} + +{{- if (not site.Params.disableScrollToTop) }} + + + + + +{{- end }} + +{{- partial "extend_footer.html" . }} + + + +{{- if (not site.Params.disableScrollToTop) }} + +{{- end }} + +{{- if (not site.Params.disableThemeToggle) }} + +{{- end }} + +{{- if (and (eq .Kind "page") (ne .Layout "archives") (ne .Layout "search") (.Param "ShowCodeCopyButtons")) }} + +{{- end }} -- cgit v1.2.3