How to comment out content in Hugo

Viewed 10589

How do I comment out content in Hugo?

If I have notes, unfinished thoughts, I'd like to leave them in the .md file but not have them appear in the html.

<!-- tags don't seem to work -- it doesn't even become a html comment, it remains visible text on the page.

3 Answers

Official doc says, HTML comment does not rendered to final HTML pages.

HTML comments are by default stripped, but their content is still evaluated. That means that although the HTML comment will never render any content to the final HTML pages, code contained within the comment may fail the build process.

https://gohugo.io/templates/introduction/#html-comments-containing-go-templates

So you can use HTML comment like this

<!-- your comment text -->

Confirmed on v0.55.0

Related