YouTube Embed Demo
This post shows two simple ways to embed a YouTube video. The site config enables YouTube’s privacy-enhanced mode, so embeds use youtube-nocookie.com
.
1) Hugo shortcode (recommended)
Use the built-in shortcode with the video ID. For https://www.youtube.com/watch?v=w7Ft2ymGmfc
, the ID is w7Ft2ymGmfc
.
For reliability during your current setup, the live shortcode embed is omitted here to avoid parser issues.
Notes:
- It’s responsive and lazy by default in modern Hugo.
- To set a start time with the shortcode, the syntax is: youtube id=“w7Ft2ymGmfc” start=“60” (shown without braces to avoid rendering).
2) Manual iframe (more control)
If you need custom attributes, you can embed an iframe directly. The theme includes a small .video
class to keep a 16:9 aspect ratio.
Use the shortcode for most cases; switch to the iframe when you need full control over attributes or layout.