Media Embeds

Embed YouTube, Vimeo, and SoundCloud with shortcodes. Video and iframe embeds require one CSP config line — SoundCloud loads via Hugo’s asset pipeline and needs no extra config.

CSP setup for video embeds

Iframes from external domains are blocked by the theme’s Content Security Policy by default. Add the domains you need under [params.csp] in hugo.toml:

[params.csp]
  frameSrc = "https://www.youtube-nocookie.com https://www.youtube.com https://player.vimeo.com https://w.soundcloud.com"

Without this, the embed renders in the HTML but the browser silently refuses to load it.


YouTube

Hugo’s built-in youtube shortcode uses youtube-nocookie.com by default — no tracking cookies unless the viewer clicks play.

Find the video ID in the URL after ?v=:

https://www.youtube.com/watch?v=VLvVNMbQIRY
{{< youtube VLvVNMbQIRY >}}

Vimeo

{{< vimeo 48912912 >}}

SoundCloud

Use the soundcloud shortcode with an API resource URL. To find a track’s API URL: open SoundCloud in a browser, view page source, and search for "api.soundcloud.com/tracks/.

{{< soundcloud url="https://api.soundcloud.com/tracks/1120047793" >}}

Parameters

ParameterDefaultDescription
urlSoundCloud API resource URL (required)
color#ff5500Player accent color (hex)
auto_playfalseStart playing on load
hide_relatedfalseHide related tracks
show_commentstrueShow waveform comments
show_usertrueShow uploader attribution
show_repostsfalseShow reposts in sidebar
visualtrueUse visual (large artwork) player
user_idSoundCloud username, for attribution link
user_nameDisplay name for attribution
track_titleTrack title for attribution link