From 72307e55ee454f8e7cee4971a4f173fdb7804dbb Mon Sep 17 00:00:00 2001 From: Julien Dessaux Date: Fri, 12 Mar 2021 12:22:57 +0100 Subject: Added RSS feed link in nav menu, prevented docs section from showing up in the home page feed and tweaked the title of the home page feed to not have the "Home on " title, juste . --- layouts/_default/baseof.html | 4 ++++ layouts/_default/rss.xml | 41 +++++++++++++++++++++++++++++++++++++++++ layouts/partials/nav.html | 3 ++- 3 files changed, 47 insertions(+), 1 deletion(-) create mode 100644 layouts/_default/rss.xml (limited to 'layouts') diff --git a/layouts/_default/baseof.html b/layouts/_default/baseof.html index b4d2a6b..3a89fba 100644 --- a/layouts/_default/baseof.html +++ b/layouts/_default/baseof.html @@ -16,6 +16,10 @@ {{- $allCss := slice $base $header $home $pagination $footer | resources.Concat "css/all.css" | fingerprint | minify -}} + {{ range .AlternativeOutputFormats -}} + {{ printf `` .Rel .MediaType.Type .Permalink $.Site.Title | safeHTML }} + {{ end -}} + {{ $title }} diff --git a/layouts/_default/rss.xml b/layouts/_default/rss.xml new file mode 100644 index 0000000..a69b0b2 --- /dev/null +++ b/layouts/_default/rss.xml @@ -0,0 +1,41 @@ +{{- $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 or (eq .Title .Site.Title) (eq .Title "Home") }}{{ .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 -- gohugo.io{{ with .Site.LanguageCode }} + {{.}}{{end}}{{ with .Site.Author.email }} + {{.}}{{ with $.Site.Author.name }} ({{.}}){{end}}{{end}}{{ with .Site.Author.email }} + {{.}}{{ with $.Site.Author.name }} ({{.}}){{end}}{{end}}{{ with .Site.Copyright }} + {{.}}{{end}}{{ if not .Date.IsZero }} + {{ .Date.Format "2006-01-02" | safeHTML }}{{ end }}{{- with .OutputFormats.Get "RSS" -}}{{ printf "" .Permalink .MediaType | safeHTML }} + {{- end -}} + {{ range $pages }} + {{ if ( ne .Section "docs" ) }} + + {{ .Title }} + {{ .Permalink }} + {{ .Date.Format "2006-01-02" | safeHTML }} + {{ with .Site.Author.email }} + {{.}}{{ with $.Site.Author.name }} ({{.}}){{end}} + {{end}} + {{ .Permalink }} + {{ .Summary | html }} + + {{ end }} + {{ end }} + + diff --git a/layouts/partials/nav.html b/layouts/partials/nav.html index f6bf6c9..b3e4863 100644 --- a/layouts/partials/nav.html +++ b/layouts/partials/nav.html @@ -2,6 +2,7 @@