Usage
{{< video src = "/videos/demo.mp4" [alt = "Demo video"] [srcPoster = "/images/demo-poster.jpg"] [thumb = "x200"] [srcClass = ""] [srcLink = "/videos"] >}}Renders an HTML5 video with optional poster image and caption
Description
Renders an HTML5 <video> element with autoplay and loop. Supports an optional poster image shown before playback — the poster is resolved via tk/get-asset and processed using the thumb parameter so it is sized correctly for its context.
Parameters
indicates required parameter
src =
"string"REQUIRED
Path to the video file (page resource or global asset)
alt =
"string"
Alt / accessibility text for the video
srcPoster =
"string"
Path to a poster image shown before the video plays. Processed using the
thumb parameter.thumb =
"string"site.Params.default.thumb.process
Hugo image process string applied to srcPoster (e.g.
x200, fit 320x180). Defaults via site params — see site.Params.default.thumb.process.srcClass =
"string"
CSS classes for the video element
srcLink =
"string"
URL to wrap around the video (makes video block clickable)
text =
"string"
Caption text rendered below the video
header =
"string"
Caption header (e.g., ‘Video 1’)
Examples
Simple autoplay video
{{<hw t="video" src="/videos/demo.mp4" alt="Product demo">}}Video autoplays and loops. No poster shown.
Video with poster image
{{<hw t="video"
src="/videos/demo.mp4"
srcPoster="/images/demo-poster.jpg"
alt="Product demo"
text="Watch the product demo">}}Poster image is processed at the site default thumb size (
x100).Video with custom poster size
{{<hw t="video"
src="/videos/demo.mp4"
srcPoster="/images/demo-poster.jpg"
thumb="fit 640x360"
alt="Product demo"
text="Watch the product demo">}}Override the default thumb process string for this specific poster.
Additional Information