How to comment out content in Hugo

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.


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


You can use HTML comments, like <!-- a comment --> , but they will appear in the rendered HTML, so you will be able to see them with "view source" in your browser.

There is no official way to make comments in Markdown documents that won't be rendered in the final HTML, but there are a few tricks you can try that will work.

Alternatively, you can make your own custom comment shortcode. Create a file with the following code at /layouts/shortcodes/comment.html :

<!-- {{ .Inner }} -->

(Shortcodes with inner text need to have an {{ .Inner }} somewhere in them, but you can get around this by using HTML comments, which in this case are stripped before they are included in the final HTML.)

You can use the shortcode in Markdown documents like this:

{{< comment >}}This is a comment that will not be rendered.{{< /comment >}}
链接地址: http://www.djcxy.com/p/20154.html

上一篇: MS Word跟踪更改和RMarkDown

下一篇: 如何评论雨果的内容