-
per default Hugo does not render HTML from markdown for security reasons. If you control the content you may turn HTML rendering on. see Configure markup | Hugo
add this in your hugo.toml
[markup.goldmark.renderer] unsafe = true
-
HTML in Summaries is not displayed with the default summary setting. You will have to switch to manual summary by adding a
<!--more-->
tag to your source (see below) docs: Content summaries | Hugo and the comparison table on that page. -
you include full HTML code into the markdown - Your markdown commonly is rendered by some templates so this is at least unnecessary (maybe it also has bad effects.)
with that my content would be:
content/posts/my-new-post.md
+++ title = 'My new Post' date = 2024-01-14T07:07:07+01:00 draft = true +++ <canvas id="gl-canvas" width="100" height="100"> Not supported </canvas> <script> let canvas = document.getElementById("gl-canvas"); let ctx = canvas.getContext("2d"); ctx.fillStyle = "#FF0000"; ctx.fillRect(0, 0, 80, 80); </script> <!--more-->
that should do the trick.