A template comment: everything from an opening brace followed by # to its matching closing brace is cut out of the template before it is expanded, so it never reaches the page. Commands inside a comment do not run at all - a commented-out view, include or rss costs nothing, and a command with a side effect (a define, a mail, an item update) inside a comment does nothing. Braces inside a comment pair the same way as everywhere else in the template, so a comment may hold whole commands and nested braces. Two cases are no comment at all: a comment that holds an empty pair of braces, and a comment without its closing brace. They stay on the page, and the commands inside them run. Only comments written in the template are cut out: a comment inside a value - an item field, an alias, a URL parameter, the text of an inline alias that no command expands - is text and shows on the page as typed. Any opening brace followed directly by # starts a comment, also in JavaScript or a Handlebars template on the page; put a space after the brace there. Use comments to leave notes for other editors, or to switch off part of a template for a while.
Examples
testbefore{# a note for other editors }after
Expectedbeforeafter
Actualbeforeafter
Everything from the opening brace with # to its closing brace is removed, so the note never reaches the page.
The define inside the comment never runs, so the variable keeps its value. A commented-out view, include or rss costs nothing either.
test[{# {view:999999} }]
Expected[]
Actual[]
Wrap any part of a template in a comment to switch it off for a while. The view inside is never rendered, so it costs no time. The output would be empty either way; example 2 shows the difference.
test[{# empty braces {} inside }]
Expected[{# empty braces {} inside }]
Actual[{# empty braces {} inside }]
A comment that holds an empty pair of braces is not removed: it stays in the output, and any command inside it runs. The same happens to a comment that is never closed. Keep empty brace pairs out of comments.