Skip to content

Commit 7537bb2

Browse files
committed
Add audio and video embedding guide to audio-video.md
1 parent 5f104d7 commit 7537bb2

1 file changed

Lines changed: 56 additions & 0 deletions

File tree

content/posts/audio-video.md

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
---
2+
title: "Audio and Video"
3+
date: 2026-04-11
4+
description: "Learn how to embed audio and video in your hugo site using shortcodes and HTML."
5+
tags: ["hugo", "audio", "video", "shortcodes", "HTML"]
6+
---
7+
8+
In this post, we'll explore how to embed audio and video content in your Hugo site using both shortcodes and HTML. This allows you to enhance your content with multimedia elements, making it more engaging for your audience.
9+
10+
## Embedding Audio
11+
12+
To embed audio in your Hugo site, you can use the built-in `audio` shortcode. Here's an example of how to use it:
13+
14+
```markdown
15+
{{/*< audio src="/path/to/your/audiofile.mp3" >*/}}
16+
```
17+
18+
{{< audio src="https://upload.wikimedia.org/wikipedia/commons/5/55/Apollo_8_liftoff.ogg" caption="Apollo 8 liftoff.ogg" >}}
19+
20+
21+
Make sure to replace `/path/to/your/audiofile.mp3` with the actual path to your audio file. This shortcode will generate an audio player that allows visitors to play the audio directly on your site.
22+
23+
Alternatively, you can also use HTML to embed audio. Here's how you can do it:
24+
25+
```html
26+
<audio controls>
27+
<source src="/path/to/your/audiofile.mp3" type="audio/mpeg">
28+
Your browser does not support the audio element.
29+
</audio>
30+
```
31+
32+
Again, replace `/path/to/your/audiofile.mp3` with the correct path to your audio file. This HTML code will create a similar audio player as the shortcode.
33+
34+
## Embedding Video
35+
36+
To embed video content, you can use the `video` shortcode in Hugo. Here's an example:
37+
38+
```markdown
39+
{{/*< video src="/path/to/your/videofile.mp4" >*/}}
40+
```
41+
42+
{{< video src="https://upload.wikimedia.org/wikipedia/commons/8/8f/Apollo_4_separation_of_interstage_ring.webm" >}}
43+
44+
45+
Make sure to replace `/path/to/your/videofile.mp4` with the actual path to your video file. This shortcode will generate a video player that allows visitors to watch the video directly on your site.
46+
47+
You can also use HTML to embed video content. Here's how you can do it:
48+
49+
```html
50+
<video controls>
51+
<source src="/path/to/your/videofile.mp4" type="video/mp4" />
52+
Your browser does not support the video element.
53+
</video>
54+
```
55+
56+
Again, replace `/path/to/your/videofile.mp4` with the correct path to your video file. This HTML code will create a video player similar to the one generated by the shortcode.

0 commit comments

Comments
 (0)