Skip to content

Instantly share code, notes, and snippets.

@manan-gup
Forked from j-un/spotify.html
Created February 23, 2021 18:06
Show Gist options
  • Save manan-gup/558f472f2bc6aabc4ad3b7d0f5e2d853 to your computer and use it in GitHub Desktop.
Save manan-gup/558f472f2bc6aabc4ad3b7d0f5e2d853 to your computer and use it in GitHub Desktop.
[Hugo] Shortcode for Spotify embed code
<!--
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 }}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment