I used Hugo static CMS to manage content on all of my blogs. But there’s a problem with embedding video on the blog post. When I put the embedded codes for the video, it’s not showing on the blog post. In my case, the blog post files are in markdown format. But, as far as I know, it’s always possible to put HTML tags inside the markdown file.
Reason why the embedded video is not showing
After inspecting the HTML element, I don’t see the embedded codes for the video there. I figured out that by default, Hugo stripped off the HTML tags that it considered dangerous: the
That means I need to figure out how to change such behavior to allow those HTML tags.
After searching here and there, I get a temporary solution to allow those HTML tags to render. Here are the details:
- Open the Hugo config file.
- Add these two lines of codes:
[markup.goldmark.renderer] unsafe = true
- Voila, the embedded video now renders on the blog post.
- Last, remember to deploy it to the server and restart it.
I know this is not an ideal solution. But it fixes the problem for now.