jlelse
/
Indieroad
Archived
1
Fork 0

Remove mentions feed, add podcast output format

This commit is contained in:
Jan-Lukas Else 2020-04-07 18:52:09 +02:00
parent 249d75d8bb
commit 4be4b56641
3 changed files with 49 additions and 28 deletions

View File

@ -1,3 +1,11 @@
outputFormats:
jsonfeed:
mediaType: "application/json"
baseName: "feed"
isPlainText: true
podcast:
mediaType: "application/rss+xml"
baseName: "podcast"
module:
hugoVersion:
extended: true

View File

@ -1,28 +0,0 @@
{{- $mentions := .Site.Data.mentions -}}
{{- $allmentions := slice -}}
{{- range $key, $pagementions := $mentions -}}
{{- range $pagekey, $mention := $pagementions -}}
{{- if $allmentions -}}
{{- $allmentions = $allmentions | append $mention -}}
{{- else -}}
{{- $allmentions = (slice $mention) -}}
{{- end -}}
{{- end -}}
{{- end -}}
{{- $allmentions = sort $allmentions "date" "desc" -}}
{
"version": "https://jsonfeed.org/version/1",
"title": "{{ T "interactions" }} {{ .Site.Title }}",
"feed_url": "{{ .Permalink }}",
"items": [
{{ $delimiter := "" -}}
{{- range first 30 $allmentions -}}
{{- $delimiter -}}{
"id": "{{ .source }}",
"url": "{{ .source }}",
"date_published": "{{ dateFormat "2006-01-02T15:04:05-07:00" .date }}"
}
{{- $delimiter = "," -}}
{{- end -}}
]
}

View File

@ -0,0 +1,41 @@
{{- printf "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"yes\" ?>" | safeHTML }}
<rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd">
<channel>
<title>{{ .Title }}</title>
<link>{{ .Permalink }}</link>
{{ with .OutputFormats.Get "PODCAST" }}{{ printf "<atom:link href=%q rel=\"self\" type=%q />" .Permalink .MediaType | safeHTML }}{{ end }}
<description>{{ .Summary | truncate 4000 ""}}</description>
<itunes:summary>{{ .Summary | truncate 4000 ""}}</itunes:summary>
{{ with .Site.LanguageCode }}<language>{{.}}</language>{{end}}
{{ with .Site.Copyright }}<copyright>{{.}}</copyright>{{end}}
<lastBuildDate>{{ dateFormat "Mon, 2 Jan 2006 15:04:05 -0700" .Lastmod }}</lastBuildDate>
<itunes:author>{{ .Site.Author.name }}</itunes:author>
<itunes:type>episodic</itunes:type>
<itunes:owner>
<itunes:name>{{ .Site.Author.name }}</itunes:name>
<itunes:email>{{ .Params.podcast.email }}</itunes:email>
</itunes:owner>
<itunes:image href="{{ .Params.podcast.image }}"></itunes:image>
<image>
<url>{{ .Params.podcast.image }}</url>
<title>{{ .Title }}</title>
<link>{{ .Permalink }}</link>
</image>
<itunes:category text="{{ .Params.podcast.category }}"></itunes:category>
<itunes:explicit>{{ .Params.explicit | default "no" }}</itunes:explicit>
{{ range .RegularPages }}
<item>
<title>{{ .Title }}</title>
<itunes:title>{{ .Title }}</itunes:title>
<link>{{ .Permalink }}</link>
<pubDate>{{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }} </pubDate>
{{ if .Params.guid }}<guid isPermaLink="false">{{ .Params.guid }}</guid>{{ else }}<guid>{{ .Permalink }}</guid>{{ end }}
<itunes:author>{{ .Site.Author.name }}</itunes:author>
<description>{{ .Summary | plainify }}</description>
<itunes:summary>{{ .Summary | plainify }}</itunes:summary>
{{ "<content:encoded><![CDATA[" | safeHTML }}{{ ( htmlUnescape (partial "cleanedContent.xml" .) ) | safeHTML }}{{"]]></content:encoded>" | safeHTML}}
<enclosure url="{{ .Params.audio }}" {{ with .Params.audioSize }}length="{{ . }}"{{ end }} {{ with .Params.audioMime }}type="{{ . }}"{{ end }}/>
</item>
{{ end }}
</channel>
</rss>