www.byjp.me/layouts/shortcodes/spotify.html
2024-03-27 15:30:14 +00:00

13 lines
867 B
HTML

{{- $displayArtist := (.Get "composer") | default (.Get "artist") -}}
{{- $displayTitle := (.Get "title") | default (.Get "album") -}}
{{- $songwhip := .Get "url" -}}
{{- if $displayArtist -}}
{{- $songwhip = printf "https://songwhip.com/%s/%s" (partial "kebab.txt" (.Get "artist")) (partial "kebab.txt" $displayTitle) }}
{{- end -}}
<figure class="embed audio spotify">
<iframe src="https://open.spotify.com/embed{{ .Get "path" }}" height="80" frameBorder="0" allowfullscreen="" allow="autoplay; clipboard-write; encrypted-media; fullscreen; picture-in-picture" loading="lazy"></iframe>
<figcaption>
🎶 {{ $displayArtist }}{{ with $displayTitle }}{{ if $displayArtist }}: {{ end }}<em>{{ . }}</em>{{ end }}<br/>
{{ with $songwhip }}<a href="{{ . }}" target="_blank" style="font-style:italic;">Listen elsewhere</a>{{ end }}
</figcaption>
</figure>