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

59 lines
1.8 KiB
HTML
Raw Normal View History

{{ define "main" }}
<div id="main">
<div class="container">
{{ partial "content.html" . }}
{{ $user := default .Site.Data.social.accounts.spotify.username .Params.user }}
2021-06-23 20:50:15 +01:00
{{ $playlist := getJSON "https://spotify-public-proxy.d.theorangeone.net/v1/users/" $user "/playlists/" .Params.playlist }}
<div class="playlist">
<h3>
<i class="fab fa-spotify"></i>
<a href="{{ $playlist.external_urls.spotify }}">
{{ $playlist.name }}
</a>
</h3>
2019-03-16 16:02:38 +00:00
<table class="table table-hover table-striped table-dark">
<thead>
<tr>
<th scope="row"></th>
<th scope="row"></th>
<th scope="row">Track</th>
<th scope="row">Artist</th>
<th scope="row">Album</th>
</tr>
</thead>
<tbody>
{{ range sort $playlist.tracks.items "track.name" }}
{{ with .track }}
{{ $spotify_url := .external_urls.spotify }}
<tr>
{{ with index .album.images 0 }}
<td>
<a href="{{ $spotify_url }}"><div class="image" data-image="{{ .url }}"></div></a>
</td>
{{ end }}
<td class="text-center">
{{ if .preview_url }}
<a href="{{ .preview_url }}"><i class="fas fa-play"></i></a>
{{ end }}
</td>
<td><a href="{{ $spotify_url }}">{{ .name }}</a></td>
<td>
{{ range $i, $e := .artists }}{{ if $i }}, {{ end }}{{ .name }}{{ end }}
</td>
<td>{{ .album.name }}</td>
</tr>
{{ end }}
{{ end }}
</tbody>
</table>
</div>
</div>
{{ partial "share.html" . }}
{{ partial "related-content.html" . }}
</div>
{{ end }}