Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR HTML

nav bar activate in jinja

{% set navigation_bar = [
    ('/', 'index', 'Index'),
    ('/downloads/', 'downloads', 'Downloads'),
    ('/about/', 'about', 'About')
] -%}

{% set active_page = active_page|default('index') -%}
...
<ul id="navigation">
    {% for href, id, caption in navigation_bar %}
    <li{% if id == active_page %} class="active"{% endif
    %}><a href="{{ href|e }}">{{ caption|e }}</a>
    </li>
{% endfor %}
</ul>
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #nav #bar #activate #jinja
ADD COMMENT
Topic
Name
7+8 =