Add a Spotify Shortcode #2876
jjanuszczak
started this conversation in
Ideas
Replies: 1 comment
-
|
Existing gist with implementation: https://gist.github.com/jjanuszczak/e523463328e8304e8ceb03c0a1e6a4f3 |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Idea: Spotify Embed Shortcode
User Story
As a content creator using the Blowfish theme,
I want a dedicated shortcode to easily embed Spotify content (tracks, albums, playlists, artists, podcasts),
so that I can share audio content with my readers in a visually integrated and performant way without writing manual HTML iframes.
Description
Spotify is one of the most popular platforms for audio content. Providing a first-class shortcode for Spotify embeds would align with Blowfish's goal of being a feature-rich theme for modern creators.
The shortcode should support:
loading="lazy"for performance andallow="encrypted-media"for functionality.Proposed Syntax
{{< spotify type="track" id="4cOdK2wG6ZIBnyG939vVpD" >}}Implementation Details (Reference)
The implementation uses a standard Spotify embed iframe with the following logic:
{{ if .IsNamedParams }} <iframe style="border-radius:12px" 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" loading="lazy"></iframe> {{ else }} <iframe style="border-radius:12px" 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" loading="lazy"></iframe> {{ end }}Beta Was this translation helpful? Give feedback.
All reactions