From efb4b4f68183a1f5a8ac3f20a1f17488ba0d470a Mon Sep 17 00:00:00 2001 From: Tixie Date: Sat, 7 Dec 2019 22:02:48 +0100 Subject: [PATCH] Add RSS feed --- config.toml | 1 + layouts/_default/baseof.html | 3 ++ layouts/index.rss.xml | 80 ++++++++++++++++++++++++++++++++++++ layouts/partials/header.html | 3 ++ 4 files changed, 87 insertions(+) create mode 100644 layouts/index.rss.xml diff --git a/config.toml b/config.toml index 4832b20..83f3011 100644 --- a/config.toml +++ b/config.toml @@ -1,6 +1,7 @@ baseURL = "http://127.0.0.1:8080/" languageCode = "en-us" title = "Now Playing" +author = "the Glitch Family" mainSections = ["musics"] paginate = 16 disableKinds = ["taxonomy", "taxonomyTerm"] diff --git a/layouts/_default/baseof.html b/layouts/_default/baseof.html index 451e68e..237e869 100644 --- a/layouts/_default/baseof.html +++ b/layouts/_default/baseof.html @@ -34,6 +34,9 @@ {{ end }} + {{ with .OutputFormats.Get "rss" -}} + {{ printf `` .Rel .MediaType.Type .Permalink $.Site.Title | safeHTML }} + {{ end -}} {{ $sass := resources.Get "/scss/style.scss" }} {{ $style := $sass | resources.ToCSS | minify | fingerprint }} diff --git a/layouts/index.rss.xml b/layouts/index.rss.xml new file mode 100644 index 0000000..d46e4ac --- /dev/null +++ b/layouts/index.rss.xml @@ -0,0 +1,80 @@ + + + {{ .Site.Title }} + {{ .Permalink }} + Handpicked Albums by the Glitch Family + 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}}{{ 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 }} + {{ $albums := (where .Site.RegularPages "Section" "musics") }} + {{ range sort $albums "Date" "desc" }} + {{ $original := resources.Get .Params.cover }} + {{ $originalPermalink := $original.Permalink }} + {{ $cover := $original.Resize "x320" }} + + "{{ .Title }}" by {{ .Params.artist }} + {{ .Permalink }} + {{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }} + {{ .Params.artist }} + {{ .Permalink }} + + + + {{ printf " + There are no links (for now~) + + {{ else }} + +
+ + {{ printf "]]>" | safeHTML }} + {{ end }} +
+
+ {{ end }} +
+
diff --git a/layouts/partials/header.html b/layouts/partials/header.html index a74c3ee..62b6111 100644 --- a/layouts/partials/header.html +++ b/layouts/partials/header.html @@ -12,6 +12,9 @@