From 1438ce758a95f288bbe5e0ada299c0e39aab5026 Mon Sep 17 00:00:00 2001 From: Jake Howard Date: Fri, 17 Aug 2018 23:03:39 +0100 Subject: [PATCH] Convert spotify shortcode to page layout --- content/projects/development-playlist.md | 4 +- .../robotics/smallpeice/2017/soundtrack.md | 9 ++-- .../smallpeice/2018/chill-soundtrack.md | 6 +-- .../smallpeice/2018/dramatic-soundtrack.md | 6 +-- data/social.yml | 6 +++ layouts/_default/spotify.html | 47 +++++++++++++++++++ layouts/shortcodes/spotify.html | 40 ---------------- 7 files changed, 62 insertions(+), 56 deletions(-) create mode 100644 layouts/_default/spotify.html delete mode 100644 layouts/shortcodes/spotify.html diff --git a/content/projects/development-playlist.md b/content/projects/development-playlist.md index dd9f6e0..f86762a 100644 --- a/content/projects/development-playlist.md +++ b/content/projects/development-playlist.md @@ -1,10 +1,10 @@ --- title: Development Playlist tags: [music] +layout: spotify +playlist: 4SLjpGGoOoiCDhc9sgNx8w --- When I work, and need to focus and get something done, I like a specific kind of music. It helps me focus and work much faster than listening to other music, or nothing at all. The work isn't necessary software development, but seeing as that's what I do most of the time, it's usually what happens. I've created this playlist over the last few years, removing and adding song when I find new ones. - -{{% spotify "theorangeone97" "4SLjpGGoOoiCDhc9sgNx8w" %}} diff --git a/content/robotics/smallpeice/2017/soundtrack.md b/content/robotics/smallpeice/2017/soundtrack.md index 8ea2ff6..03ec72e 100644 --- a/content/robotics/smallpeice/2017/soundtrack.md +++ b/content/robotics/smallpeice/2017/soundtrack.md @@ -1,10 +1,7 @@ --- title: Soundtrack +layout: spotify +playlist: 4ZaS9NTwF1erqqpE1IxHlP --- -At the arena, we had music playing in the background, through the competition stages, and the testing phase. - - - -{{% spotify "theorangeone97" "4ZaS9NTwF1erqqpE1IxHlP" %}} - +At the arena, we had music playing in the background, through the competition stages, and the testing phase. diff --git a/content/robotics/smallpeice/2018/chill-soundtrack.md b/content/robotics/smallpeice/2018/chill-soundtrack.md index b06dbb1..3b3f17a 100644 --- a/content/robotics/smallpeice/2018/chill-soundtrack.md +++ b/content/robotics/smallpeice/2018/chill-soundtrack.md @@ -1,9 +1,7 @@ --- title: Chill Soundtrack +layout: spotify +playlist: 2YDsE6BLEdjTSXhFRnVXq9 --- This year, we tried something different. Rather than having the [dramatic playlist]({{< relref "dramatic-soundtrack" >}}), we created a chill playlist for outside of match time. This not only helped make the breaks feel more like breaks, and a bit more fun, but also acted as a contrast to make the match time feel more dramatic. - - - -{{% spotify "theorangeone97" "2YDsE6BLEdjTSXhFRnVXq9" %}} diff --git a/content/robotics/smallpeice/2018/dramatic-soundtrack.md b/content/robotics/smallpeice/2018/dramatic-soundtrack.md index a2116ca..34d7acf 100644 --- a/content/robotics/smallpeice/2018/dramatic-soundtrack.md +++ b/content/robotics/smallpeice/2018/dramatic-soundtrack.md @@ -1,7 +1,5 @@ --- title: Dramatic Soundtrack +layout: spotify +playlist: 5VvONyDmSpdErqseA75Vad --- - - - -{{% spotify "theorangeone97" "5VvONyDmSpdErqseA75Vad" %}} diff --git a/data/social.yml b/data/social.yml index 8b48cc3..899217d 100644 --- a/data/social.yml +++ b/data/social.yml @@ -90,6 +90,12 @@ accounts: link: https://news.ycombinator.com/user?id=theorangeone icon: fab fa-hacker-news-square + spotify: + name: Spotify + username: theorangeone97 + link: https://open.spotify.com/user/theorangeone97 + icon: fab fa-spotify + footer_accounts: - github - twitter diff --git a/layouts/_default/spotify.html b/layouts/_default/spotify.html new file mode 100644 index 0000000..e46c204 --- /dev/null +++ b/layouts/_default/spotify.html @@ -0,0 +1,47 @@ +{{ define "main" }} +
+
+ {{ partial "content.html" . }} + + {{ $user := default .Site.Data.social.accounts.spotify.username .Params.user }} + + {{ $playlist := getJSON "https://spotify-public-proxy.herokuapp.com/v1/users/" $user "/playlists/" .Params.playlist }} + +
+

+ + + {{ $playlist.name }} + +

+ + + + + + + + + + + + {{ range sort $playlist.tracks.items "track.name" }} + {{ with .track }} + + {{ with index (last 1 .album.images) 0 }} + + {{ end }} + + + + + {{ end }} + {{ end }} + +
TrackArtistAlbum
{{ .name }} + {{ range $i, $e := .artists }}{{ if $i }}, {{ end }}{{ .name }}{{ end }} + {{ .album.name }}
+
+
+
+{{ end }} diff --git a/layouts/shortcodes/spotify.html b/layouts/shortcodes/spotify.html deleted file mode 100644 index e056696..0000000 --- a/layouts/shortcodes/spotify.html +++ /dev/null @@ -1,40 +0,0 @@ -{{ $user := .Get 0 }} -{{ $playlist_id := .Get 1 }} - -{{ $playlist := getJSON "https://spotify-public-proxy.herokuapp.com/v1/users/" $user "/playlists/" $playlist_id }} - -
-

- - - {{ $playlist.name }} - -

- - - - - - - - - - - - {{ range sort $playlist.tracks.items "track.name" }} - {{ with .track }} - - {{ with index (last 1 .album.images) 0 }} - - {{ end }} - - - - - {{ end }} - {{ end }} - -
TrackArtistAlbum
{{ .name }} - {{ range $i, $e := .artists }}{{ if $i }}, {{ end }}{{ .name }}{{ end }} - {{ .album.name }}
-