Tags can be trickier to understand than filters because they can do so much more. Tags allow for programming logic in your template code, such as looping through records with the {%
for
%}
tag and performing conditional logic with the {%
ifequal
%}
tag. If you're unsure whether to use a tag or a filter, think about what you're trying to accomplish. If it's simple display formatting, you'll probably use a filter; if it's something more involved, you'll probably need a tag.
To use a tag, you put a single bracket and percent symbol around the tag name. Many tags require an ending tag, such as the ifequal/endifequal
tag in this example:
{% ifequal object.color 'blue' %} The object is blue. {% else %} The object is not blue {% endifequal %}