The {% comment %} tag prevents anything inside it from being executed or output. It is primarily used for one of two purposes:
- For a developer to leave notes behind so that when they or another developer looks at the code later they understand what it is doing.
- To temporarily "remove" a block of code from a template so that it is no longer evaluated but is easy to add back later. This is particularly helpful when troubleshooting a template error.
Syntax
{% comment %}...{% endcomment %}
Examples
{% comment %}
This text will not be output
{% endcomment %}