How to comment out content in Hugo

Hugo uses Go templates under the hood, so the comment syntax is {{/* a comment */}}. Anything inside the comment will not be rendered to the resulting HTML files.

Official Hugo comments documentation


See this example for a no-op shortcode that can be used to add comments in content files:

https://github.com/gohugoio/hugoDocs/blob/master/layouts/shortcodes/todo.html


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

Tags:

Hugo