1
Fork 0
theorangeone.net-legacy/layouts/shortcodes/spotify.html

41 lines
1.1 KiB
HTML
Raw Normal View History

2018-01-14 21:10:29 +00:00
{{ $user := .Get 0 }}
{{ $playlist_id := .Get 1 }}
2017-10-15 15:25:54 +01:00
2018-05-27 15:11:08 +01:00
{{ $playlist := getJSON "https://spotify-public-proxy.herokuapp.com/v1/users/" $user "/playlists/" $playlist_id }}
2017-10-15 15:25:54 +01:00
<div class="playlist">
2018-08-17 22:37:17 +01:00
<h3>
<i class="fab fa-spotify"></i>
<a href="{{ $playlist.external_urls.spotify }}">
2017-10-15 15:25:54 +01:00
{{ $playlist.name }}
2018-08-17 22:37:17 +01:00
</a>
</h3>
2017-10-15 15:25:54 +01:00
2017-11-10 21:42:17 +00:00
<table class="table table-hover table-striped">
2017-10-15 15:25:54 +01:00
<thead>
<tr>
2018-01-20 11:56:31 +00:00
<th scope="row"></th>
2017-11-10 21:42:17 +00:00
<th scope="row">Track</th>
<th scope="row">Artist</th>
<th scope="row">Album</th>
2017-10-15 15:25:54 +01:00
</tr>
</thead>
<tbody>
2018-01-14 21:10:29 +00:00
{{ range sort $playlist.tracks.items "track.name" }}
{{ with .track }}
<tr>
2018-01-20 11:56:31 +00:00
{{ with index (last 1 .album.images) 0 }}
<td><div class="image" data-image="{{ .url }}"></div></td>
{{ end }}
2018-01-14 21:10:29 +00:00
<td><a href="{{ .external_urls.spotify }}">{{ .name }}</a></td>
<td>
{{ range $i, $e := .artists }}{{ if $i }}, {{ end }}{{ .name }}{{ end }}
</td>
<td>{{ .album.name }}</td>
</tr>
{{ end }}
2017-10-15 15:25:54 +01:00
{{ end }}
</tbody>
</table>
</div>