diff options
author | runningstream <runningstreamllc@gmail.com> | 2020-02-01 09:36:48 +0300 |
---|---|---|
committer | runningstream <runningstreamllc@gmail.com> | 2020-02-01 09:36:48 +0300 |
commit | 630f5e2d1d33912d79af07a3ef1667cc5caa4296 (patch) | |
tree | 531600e2a524702ba52db4fcd0828a52b5d4c366 | |
parent | da48d2e04e2140efed3d40ab42f1d92dadd519b4 (diff) |
Add some RSS, even if just the header
-rw-r--r-- | layouts/_default/index.xml | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/layouts/_default/index.xml b/layouts/_default/index.xml index e69de29..e039610 100644 --- a/layouts/_default/index.xml +++ b/layouts/_default/index.xml @@ -0,0 +1,24 @@ +{{- $pctx := . -}} +{{- if .IsHome -}}{{ $pctx = .Site }}{{- end -}} +{{- $pages := $pctx.RegularPages -}} +{{- $limit := .Site.Config.Services.RSS.Limit -}} +{{- if ge $limit 1 -}} +{{- $pages = $pages | first $limit -}} +{{- end -}} +{{- printf "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"yes\"?>" | safeHTML }} +<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"> + <channel> + <title>{{ if eq .Title .Site.Title }}{{ .Site.Title }}{{ else }}{{ with .Title }}{{.}} on {{ end }}{{ .Site.Title }}{{ end }}</title> + <link>{{ .Permalink }}</link> + <description>Recent content {{ if ne .Title .Site.Title }}{{ with .Title }}in {{.}} {{ end }}{{ end }}on {{ .Site.Title }}</description> + <generator>Hugo -- gohugo.io</generator>{{ with .Site.LanguageCode }} + <language>{{.}}</language>{{end}}{{ with .Site.Author.email }} + <managingEditor>{{.}}{{ with $.Site.Author.name }} ({{.}}){{end}}</managingEditor>{{end}}{{ with .Site.Author.email }} + <webMaster>{{.}}{{ with $.Site.Author.name }} ({{.}}){{end}}</webMaster>{{end}}{{ with .Site.Copyright }} + <copyright>{{.}}</copyright>{{end}}{{ if not .Date.IsZero }} + <lastBuildDate>{{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</lastBuildDate>{{ end }} + {{ with .OutputFormats.Get "RSS" }} + {{ printf "<atom:link href=%q rel=\"self\" type=%q />" .Permalink .MediaType | safeHTML }} + {{ end }} + </channel> +</rss> |