How do I add HTML to my posts?

I tried embedding a Firefox video as an i-frame in one of my posts on my Hugo site, and it displayed the video, but gave me an error that I don’t remember. It was a playback error.

Yesterday, I also tried to embed a Reddit comment, which also gave me a HTML line, which once again, after placing in my post, didn’t give me anything at all.

I know Twitter does the same thing with tweets.

Is there a way I can embed these one-liners of HTML that so many sites allow you access to?

I don’t know what that means.

1 Like

It would have been useful for me to include an example.

An example for a YouTube video might look like:

<iframe width="560" height="315" src="https://www.youtube-nocookie.com/embed/0RKpf3rK57I?si=1lHDA2TmCr5tacn-" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" allowfullscreen></iframe>

For instance.

Yes, but you have not described the problem.

Well, when I paste that into a post, for most embeds it gives me no visual change, and for YouTube videos it gives me an i-frame with a playback error.

By default, you cannot mix raw HTML with markdown.

To enable that capability, edit your site configuration.

[markup.goldmark.renderer]
unsafe = true
1 Like

Is there a YAML version of this?

(I feel very new still…)

Do a Google search for toml to yaml converter.

1 Like

For a lot of what you are asking, such as html embeds, I would recommend you use shortcodes. They already have builtin internal ones for common things like youtube, twitter, vimeo… and you can easily add your own to your theme as well.

2 Likes

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.