1
Fork 0

Add spotify playlist shortcode

This commit is contained in:
Jake Howard 2017-10-15 15:25:54 +01:00
parent 665ec9989c
commit d4c4987721
Signed by: jake
GPG key ID: 57AFB45680EDD477
2 changed files with 45 additions and 0 deletions

View file

@ -0,0 +1,41 @@
{{ $ident := .Get 0 }}
{{ $playlist := getJSON "http://spotify-public-proxy.theorangeone.net/playlist/" $ident }}
<div class="playlist">
<a href="{{ $playlist.url }}">
<h3>
{{ $playlist.name }}
</h3>
</a>
<table>
<thead>
<tr>
<th></th>
<th>Track</th>
<th>Artist</th>
<th>Album</th>
</tr>
</thead>
<tbody>
{{ range sort $playlist.tracks "name" }}
<tr>
<td>
<span>
<a class="icon" href="{{ .preview_url }}"><i class="fa fa-play"></i></a>
</span>
</td>
<td><a href="{{ .url }}">{{ .name }}</a></td>
<td>
{{ range $i, $e := .artists }}{{ if $i }}, {{ end }}{{ .name }}{{ end }}
</td>
<td>{{ .album.name }}</td>
</tr>
{{ end }}
<tr><td colspan="4">
<a href="{{ $playlist.url }}">View playlist on Spotify</a>
</td></tr>
</tbody>
</table>
</div>

View file

@ -188,3 +188,7 @@ nav {
text-align: center; text-align: center;
} }
} }
table td {
vertical-align: middle;
}