Closed paulba closed 9 years ago
Use the if_current_page
built-in template tag, like this:
<li class="{% if_current_page '/index.html' 'active' 'inactive' %}">Home</li>
This will apply the active
CSS class if the current page is the one from ./pages/index.html
, and inactive
otherwise.
Note that you can of course replace 'inactive'
with just ''
if you'd rather not apply anything in case the current page isn't the one you're looking for.
Hi! I'm new to cactus and python and I can't find an answer for this anywhere. How can I apply a custom css class on a navigation list item depending on the current active page? Do I need a plugin for this?
Thanks