I’m looking to underline the element in the navigation bar which corresponds to the page that I’m on.
Example: If I’m on the download page, like the Django website I want it to make the download text in navigation bar darker.
I can do this with normal HTML and CSS but what I’m doing is I have a base.html and I extend that to all my pages. In the base.html I also extend navigationBar.html so it doesn’t look cluttered.
You can’t directly propagate data up through the extends chain.
I’m aware of at least three different ways to work around this limitation.
Add {% block <xxx> %}{% endblock %} directives in your class attributes allowing your downstream templates to set the right block with the right attribute.
Change your template structure such that your base template doesn’t extend navigationBar. Instead, have your base template allocation a block for the nagivation bar, but have your template include the navigation bar with the right information supplied to it - to be rendered within that block.
Then I load that to the navbar template and use it for each item to decide whether to add some extra formatting. In my case I’m making the text all uppercase, but you could do something different.