Reputation: 2037
I want to check that current page is home page or not in django template. How I can do this?
Upvotes: 0
Views: 811
Reputation: 2037
If we assume that home page url is /, we can check that by
{% if request.path == '/' %}
<h1 id="nameid" class="display-6 fs-3">{{settings.title}}</h1>
{% else %}
<h2 id="nameid" class="display-6 fs-3">{{settings.title}}</h2>
{% endif %}
For other page for example about page, we can use {% if request.path == '/about/' %}
Upvotes: 1