1
0
Fork 0
mirror of https://github.com/GuerillaStudio/now-playing synced 2024-12-21 05:21:57 +00:00
now-playing/layouts/index.rss.xml
2023-02-20 02:08:02 +01:00

75 lines
3.3 KiB
XML

<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
<channel>
<title>{{ .Site.Title }}</title>
<link>{{ .Permalink }}</link>
<description>{{ .Site.Params.description }}</description>
<description>{{ .Site.Params.author.name }}</description>
<generator>Hugo -- gohugo.io</generator>{{ with .Site.LanguageCode }}
<language>{{.}}</language>{{end}}{{ with .Site.Params.author.name }}
<managingEditor>{{.}}</managingEditor>{{end}}{{ with .Site.Params.author.name }}
<webMaster>{{.}}</webMaster>{{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 }}
{{ $albums := (where .Site.RegularPages "Section" "a") }}
{{ range sort $albums "Date" "desc" }}
{{ $original := resources.Get .Params.cover }}
{{ $originalPermalink := $original.Permalink }}
{{ $cover := $original.Resize "x320" }}
<item>
<title>"{{ .Title }}" by {{ .Params.artist }}</title>
<link>{{ .Permalink }}</link>
<pubDate>{{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</pubDate>
<guid>{{ .Permalink }}</guid>
<media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="{{ $cover.Permalink }}" height="320" width="320" />
<link rel="enclosure" type="image/png" length="320" href="{{ $cover.Permalink }}"/>
<description type="html">
{{ printf "<![CDATA[" | safeHTML }}
Listen this album on:
{{ if not (.Params.links.spotify | or .Params.links.youtube | or .Params.links.applemusic | or .Params.links.soundcloud | or .Params.links.bandcamp | or .Params.links.deezer) }}
<div>
There are no links (for now~)
</div>
{{ else }}
<div class="album-links__list">
{{ if .Params.links.spotify }}
<div>
Spotify: <a href="{{ .Params.links.spotify }}">{{ .Params.links.spotify }}</a></a>
</div>
{{ end }}
{{ if .Params.links.youtube }}
<div>
Youtube: <a href="{{ .Params.links.youtube }}">{{ .Params.links.youtube }}</a></a>
</div>
{{ end }}
{{ if .Params.links.applemusic }}
<div>
Apple Music: <a href="{{ .Params.links.applemusic }}">{{ .Params.links.applemusic }}</a></a>
</div>
{{ end }}
{{ if .Params.links.soundcloud }}
<div>
Soundcloud: <a href="{{ .Params.links.soundcloud }}">{{ .Params.links.soundcloud }}</a></a>
</div>
{{ end }}
{{ if .Params.links.bandcamp }}
<div>
Bandcamp: <a href="{{ .Params.links.bandcamp }}">{{ .Params.links.bandcamp }}</a></a>
</div>
{{ end }}
{{ if .Params.links.deezer }}
<div>
Deezer: <a href="{{ .Params.links.deezer }}">{{ .Params.links.deezer }}</a></a>
</div>
{{ end }}
</div>
<br/>
<img src="{{ $cover.Permalink }}" />
{{ printf "]]>" | safeHTML }}
{{ end }}
</description>
</item>
{{ end }}
</channel>
</rss>