From f2cba8e856acb81c83874830e9f863ef701a2d88 Mon Sep 17 00:00:00 2001 From: shockrah Date: Mon, 14 Mar 2022 22:53:37 -0700 Subject: [PATCH] +! New RSS template for the index --- themes/shockrah.xyz/layouts/_default/rss.xml | 39 +++++++++++++++++++ .../shockrah.xyz/layouts/partials/header.html | 3 ++ themes/shockrah.xyz/theme.toml | 4 +- 3 files changed, 44 insertions(+), 2 deletions(-) create mode 100644 themes/shockrah.xyz/layouts/_default/rss.xml diff --git a/themes/shockrah.xyz/layouts/_default/rss.xml b/themes/shockrah.xyz/layouts/_default/rss.xml new file mode 100644 index 0000000..e49c966 --- /dev/null +++ b/themes/shockrah.xyz/layouts/_default/rss.xml @@ -0,0 +1,39 @@ +{{- $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 }} + 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 "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}{{ end }} + {{- with .OutputFormats.Get "RSS" -}} + {{ printf "" .Permalink .MediaType | safeHTML }} + {{- end -}} + {{ range $pages }} + + {{ .Title }} + {{ .Permalink }} + {{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }} + {{ with .Site.Author.email }}{{.}}{{ with $.Site.Author.name }} ({{.}}){{end}}{{end}} + {{ .Permalink }} + {{ .Content | html }} + + {{ end }} + + diff --git a/themes/shockrah.xyz/layouts/partials/header.html b/themes/shockrah.xyz/layouts/partials/header.html index 3c293e3..3fd45d0 100644 --- a/themes/shockrah.xyz/layouts/partials/header.html +++ b/themes/shockrah.xyz/layouts/partials/header.html @@ -19,6 +19,9 @@
  • Donations
  • +
  • + RSS +
  • diff --git a/themes/shockrah.xyz/theme.toml b/themes/shockrah.xyz/theme.toml index cf9f291..a2aba04 100644 --- a/themes/shockrah.xyz/theme.toml +++ b/themes/shockrah.xyz/theme.toml @@ -2,8 +2,8 @@ # See https://github.com/gohugoio/hugoThemes#themetoml for an example name = "shockrah.xyz" -license = "" -licenselink = "https://github.com/yourname/yourtheme/blob/master/LICENSE" +license = "MIT" +licenselink = "https://gitlab.com/shockrah/shockrah-city/-/blob/master/LICENSE" description = "" homepage = "http://example.com/" tags = ["blog", "tech", "maker"]