I created a comment
shortcode for internal comments that are excluded from the HTML output and page source.
Shortcode Definition (layouts/comment.html)
{{ if 0 }}{{.Inner}}{{ end }}
Shortcode Usage
{{% comment %}}Internal comment{{% /comment %}}
Note
I read on the discussion forum that by default, Hugo removes HTML comments from the output. However, in my tests HTML comments in Markdown files appear in the output page source?
Regardless, you might prefer no to use HTML comment syntax even if it is entirely excluded from the output — for example, if you want to use nested HTML comments in your comment.