Lay foundation for RSS rework

This commit is contained in:
moanos [he/him] 2023-06-21 17:11:25 +02:00
parent e256fb4d5f
commit 89cf19ecd1
3 changed files with 50 additions and 3 deletions

View File

@ -80,8 +80,6 @@ paginate = 5 #frontpage pagination
instagram = "https://www.instagram.com/julian_samuel_gebuehr/" instagram = "https://www.instagram.com/julian_samuel_gebuehr/"
facebook = "https://www.facebook.com/juliansamuel.gebuhr" facebook = "https://www.facebook.com/juliansamuel.gebuhr"
mastodon = "https://chaos.social/@moanos" mastodon = "https://chaos.social/@moanos"
#pinterest = "full profile url in pinterest"
#googleplus = "full profile url in googleplus"
rss = true rss = true
[[params.fediverse]] [[params.fediverse]]
url = "https://chaos.social/@moanos" url = "https://chaos.social/@moanos"
@ -92,3 +90,8 @@ paginate = 5 #frontpage pagination
[[params.fediverse]] [[params.fediverse]]
url = "https://pixelfed.social/@moanos" url = "https://pixelfed.social/@moanos"
name= "Pixelfed" name= "Pixelfed"
[outputs]
home = ["HTML", "RSS"]

44
layouts/rss.xml Normal file
View File

@ -0,0 +1,44 @@
{{- $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 "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"yes\"?>" | safeHTML }}
{{- printf "<?xml-stylesheet href=\"/rss.xsl\" type=\"text/xsl\"?>" | safeHTML }}
<feed xmlns="http://www.w3.org/2005/Atom"
xmlns:media="http://search.yahoo.com/mrss/">
<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>
<language>{{ site.LanguageCode }}</language>{{ 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 "<link href=%q rel=\"self\" type=%q />" .Permalink .MediaType | safeHTML }}
{{- end -}}
{{ range $pages }}
<item>
<title>{{ .Title }}</title>
<link>{{ .Permalink }}</link>
<pubDate>{{ .Date.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>{{ .Content | html }}</description>
</item>
{{ end }}
</feed>

@ -1 +1 @@
Subproject commit 79d7abbab69ce48fbfeb5bb74222a509fb9e0de5 Subproject commit c2f903d0b270e90dba32e6ae51690e55cb523f56