FLX
FLX

Reputation: 4714

Conditional on title in template?

I can get output on the current page title by doing:

{% block title %}{% endblock %}

However, how can I use this in a conditional? This doesn't seem to work:

{% if title == "Bla" %}
   doing some stuff!
{% endif %}

Thanks!

Upvotes: 0

Views: 257

Answers (1)

Andrew Clark
Andrew Clark

Reputation: 208495

Your current syntax is correct according to the Django docs, double check that title has the value you think it does.

== operator
Equality. Example:

{% if somevar == "x" %}
    This appears if variable somevar equals the string "x"
{% endif %}

Upvotes: 1

Related Questions