Writing & Markdown

Video & Audio

Embed self-hosted video, audio files, YouTube, Vimeo, and Bilibili videos in Hugo using the video and audio shortcodes.

Video

Embed self-hosted videos from your page bundle or assets/media/.

{{</* video src="demo.mp4" */>}}

With Poster Image

{{</* video src="demo.mp4" poster="thumb.jpg" */>}}

With Controls

By default, videos autoplay and loop. Add controls to show the video player controls instead:

{{</* video src="demo.mp4" controls="true" */>}}

Parameters

ParameterTypeDefaultDescription
srcstringRequired. Path to video file or remote URL
posterstring{src}.jpgPreview image (auto-detects matching .jpg)
controlsstringIf present, show player controls instead of autoplay/loop
idstringCustom ID for the <video> element (prefixed with video-)

File Resolution

Video files are resolved in this order:

  1. Page bundle (same folder as index.md)
  2. Media library (assets/media/)
  3. Remote URL (if starts with http)

Audio

Embed audio files:

{{</* audio src="podcast.mp3" */>}}

Audio follows the same file resolution order as video.

YouTube, Vimeo & More

Use the embed shortcode for third-party video platforms:

{{</* embed src="https://www.youtube.com/watch?v=dQw4w9WgXcQ" */>}}

Bilibili

Embed Bilibili videos:

{{</* bilibili id="VIDEO_ID" */>}}

Use Page Bundles (folders named index.md) so your media files (demo.mp4, podcast.mp3) can live right next to your content file. This makes src="demo.mp4" work without path headaches.

Was this page helpful?

From the makers of

© 2026 Lore Labs.

On this page