I have my main navigation bar located in the base.html
file and I include it in all other pages. However, I currently have the class "active"
assigned to the home page link, causing it to remain active on all other pages as well.
<ul class="navbar-nav">
<li class="nav-item">
<a class="nav-link active" href="http://127.0.0.1:8000/backend/">
<i class="ni ni-shop text-primary"></i>
<span class="nav-link-text">Dashboard</span>
</a>
</li>
<li class="nav-item">
<a class="nav-link" href="http://127.0.0.1:8000/backend/clientes">
<i class="ni ni-ungroup text-orange"></i>
<span class="nav-link-text">Clients</span>
</a>
</li>
</ul>
Is there a way for me to dynamically change the active
class to reflect the current page's menu item?