mirror of
https://github.com/GuerillaStudio/now-playing
synced 2024-11-29 22:41:41 +00:00
Add RSS feed
This commit is contained in:
parent
d4ad7cf8a6
commit
efb4b4f681
4 changed files with 87 additions and 0 deletions
|
@ -1,6 +1,7 @@
|
||||||
baseURL = "http://127.0.0.1:8080/"
|
baseURL = "http://127.0.0.1:8080/"
|
||||||
languageCode = "en-us"
|
languageCode = "en-us"
|
||||||
title = "Now Playing"
|
title = "Now Playing"
|
||||||
|
author = "the Glitch Family"
|
||||||
mainSections = ["musics"]
|
mainSections = ["musics"]
|
||||||
paginate = 16
|
paginate = 16
|
||||||
disableKinds = ["taxonomy", "taxonomyTerm"]
|
disableKinds = ["taxonomy", "taxonomyTerm"]
|
||||||
|
|
|
@ -34,6 +34,9 @@
|
||||||
<meta name="twitter:description" content="Handpicked Albums by the Glitch Family" />
|
<meta name="twitter:description" content="Handpicked Albums by the Glitch Family" />
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
||||||
|
{{ with .OutputFormats.Get "rss" -}}
|
||||||
|
{{ printf `<link rel="%s" type="%s" href="%s" title="%s" />` .Rel .MediaType.Type .Permalink $.Site.Title | safeHTML }}
|
||||||
|
{{ end -}}
|
||||||
|
|
||||||
{{ $sass := resources.Get "/scss/style.scss" }}
|
{{ $sass := resources.Get "/scss/style.scss" }}
|
||||||
{{ $style := $sass | resources.ToCSS | minify | fingerprint }}
|
{{ $style := $sass | resources.ToCSS | minify | fingerprint }}
|
||||||
|
|
80
layouts/index.rss.xml
Normal file
80
layouts/index.rss.xml
Normal file
|
@ -0,0 +1,80 @@
|
||||||
|
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
|
||||||
|
<channel>
|
||||||
|
<title>{{ .Site.Title }}</title>
|
||||||
|
<link>{{ .Permalink }}</link>
|
||||||
|
<description>Handpicked Albums by the Glitch Family</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}}{{ 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" "musics") }}
|
||||||
|
{{ 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>
|
||||||
|
<author><name>{{ .Params.artist }}</name></author>
|
||||||
|
<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.googleplay | 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.googleplay }}
|
||||||
|
<div>
|
||||||
|
Google Play: <a href="{{ .Params.links.googleplay }}">{{ .Params.links.googleplay }}</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>
|
|
@ -12,6 +12,9 @@
|
||||||
</div>
|
</div>
|
||||||
<nav class="navigation" data-menu="navigation">
|
<nav class="navigation" data-menu="navigation">
|
||||||
<a class="navigation__item {{ if .IsHome }}active{{ end }}" href="/">Latest</a>
|
<a class="navigation__item {{ if .IsHome }}active{{ end }}" href="/">Latest</a>
|
||||||
|
{{ with .OutputFormats.Get "RSS" }}
|
||||||
|
<a class="navigation__item" href="{{ .RelPermalink }}">RSS</a>
|
||||||
|
{{ end }}
|
||||||
<button class="navigation__item" data-random="btn">Random</button>
|
<button class="navigation__item" data-random="btn">Random</button>
|
||||||
</nav>
|
</nav>
|
||||||
<div class="navigation__mobileOverlay" data-menu="overlay"></div>
|
<div class="navigation__mobileOverlay" data-menu="overlay"></div>
|
||||||
|
|
Loading…
Reference in a new issue