zishu's blog

zishu's blog

一个热爱生活的博主。https://zishu.me

How to make Hugo support rendering HTML code?

To insert iframes, videos, and other tags like summary in articles, you can configure the config file.

  1. If it is config.toml, add the following configuration:
[markup]
  [markup.goldmark]
    [markup.goldmark.renderer]
      unsafe = true
  1. If it is config.yaml, add the following configuration:
markup:
  goldmark:
    renderer:
      unsafe: true

This way, you can insert iframes, videos, and other tags like summary in articles.

Otherwise, the following comment will be displayed and HTML code will be automatically filtered.

<!-- raw HTML omitted -->

Compare the differences before and after adding the configuration:

image

image

Loading...
Ownership of this post data is guaranteed by blockchain and smart contracts to the creator alone.