Comments
Haml, Slim, and EGO templates all support comments, but the markers differ by language, and the same / character means opposite things in Haml and Slim. Comments can either be left in the rendered HTML or removed from the rendered HTML.
Haml Comments
In Haml, a rendered HTML comment is created by using the forward slash / character.
renders as:
Haml comments that are removed from the rendered HTML entirely are created by using a dash and a pound -# character combination.
renders as:
These types of comments are stripped out and will not become part of the generated Go code.
Slim Comments
Slim reverses the two Haml markers: / on its own is the silent comment, removed entirely from the rendered HTML, and /! is the one that renders as an HTML comment.
renders as:
If you’re moving between Haml and Slim, remember that Slim’s plain / behaves like Haml’s -#, not like Haml’s plain /.
EGO Comments
EGO comments use <%# ... %> and are removed from the rendered HTML.
Nesting
Both kinds of comments can be used to comment out multiple lines of content.
renders as:
The examples above are Haml. The same nesting works with Slim’s markers: indent lines under /! to nest them inside a preserved HTML comment, or under / to remove them all silently.
Conditional Comments
Conditional comments are a feature of Internet Explorer in versions prior to IE 10. They are used to include or exclude content from the page based on the version of Internet Explorer that is being used. They are not part of the HTML5 specification and are not supported by GoHT.