1
0
Fork 0
mirror of https://git.sr.ht/~seirdy/seirdy.one synced 2024-11-30 15:22:09 +00:00
seirdy.one/layouts/_default/rss.xml
2023-11-29 05:52:05 -08:00

52 lines
2.4 KiB
XML

{{- $pages := (where site.RegularPages "Section" .Section) -}}
{{- $limit := .Site.Config.Services.RSS.Limit -}}
{{- if ge $limit 1 -}}
{{- $pages = $pages | first $limit -}}
{{- end -}}
{{- $period := "daily" -}}
{{- $mins := "1440" -}}
{{- $title := .Section | humanize -}}
{{- if eq .Section "notes" -}}
{{- $period = "hourly" -}}
{{- $mins = "60" -}}
{{- end -}}
{{- if .IsHome }}
{{- $period := "hourly" -}}
{{- $title = "All content" -}}
{{- $pages = where .Site.RegularPages "Date" "!=" (time "0001-01-01") -}}
{{- $mins = "60" -}}
{{ end -}}
{{- printf "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"yes\"?>" | safeHTML }}
<rss version="2.0"
xmlns:atom="http://www.w3.org/2005/Atom"
xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
xml:lang="{{ .Site.LanguageCode }}">
<channel>
<title>{{ $title }} on {{ .Site.Title }}</title>
<link>{{ .Permalink }}</link>
<description>Recent content {{ if ne .Title .Site.Title }}{{ with .Title }}in {{.}} {{ end }}{{ end }}on {{ .Site.Title }}</description>
<ttl>{{ $mins }}</ttl>
<sy:updatePeriod>{{ $period }}</sy:updatePeriod>
<sy:updateFrequency>1</sy:updateFrequency>
<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.UTC.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 }}
{{ range $pages }}
<item>
{{- .Page.Scratch.Set "codeIndex" 1 -}}
<title>{{ .Title }}</title>
<link>{{ .Permalink }}</link>
<pubDate>{{ .Date.UTC.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</pubDate>
{{ with .Site.Author.email }}<author>{{.}}{{ with $.Site.Author.name }} ({{.}}){{end}}</author>{{end}}
<guid>{{ .Permalink }}</guid>
<description xml:base="{{ .Permalink }}">{{- .Content | replaceRE `(?: )?(?:item(type|scope|prop|id|ref)="[^"]*"|class="language-figure")` "" | replaceRE `<meta content="true" ?/>` "" | html -}}</description>
</item>
{{ end }}
</channel>
</rss>