Hugo shortcodes are fucking awesome.
Oh my god, Hugo is just the greatest framework for static site generation (and this blog).
I checked out this previous Enlightening Thought which had a link to a youtube video, and found that it was blocked from embed on non-youtube sites. Turns out there’s no spotify shortcode native to Hugo, but you can easily make one for use across your blog!
I found this code in a github gist by user j-un, and it was so simple to follow, here’s a copy:
<!--
Parameters:
type - (Required) album / track / playlist / artist
id - (Required) Target ID
width - (Optional) width
height - (Optional) height
-->
{{ if .IsNamedParams }}
<iframe src="https://open.spotify.com/embed/{{ .Get "type" }}/{{ .Get "id" }}"
width="{{ default "100%" (.Get "width") }}"
height="{{ default "380" (.Get "height") }}"
frameborder="0"
allowtransparency="true"
allow="encrypted-media"></iframe>
{{ else }}
<iframe src="https://open.spotify.com/embed/{{ .Get 0 }}/{{ .Get 1 }}"
width="{{ default "100%" (.Get 2) }}"
height="{{ default "380" (.Get 3) }}"
frameborder="0"
allowtransparency="true"
allow="encrypted-media"></iframe>
{{ end }}
dumping that into layouts/shortcodes/spotify.html and ammending the resulting blog post to use {{``< spotify type="track" id="32vbyo69yJq5WXyvHCF0Yp" width="100%" height="250" >``}} gave the desired result. (just remove the extra backticks, I had to solve for formatting issues on this post)
Is making shortcodes for embeds really this easy?! I need to experiment further, does bluesky have an embed function for me to mess with?!