How to use if/else condition on Django Templates?

You shouldn’t use the double-bracket {{ }} syntax within if or ifequal statements, you can simply access the variable there like you would in normal python:

{% if title == source %}
   ...
{% endif %}

Leave a Comment