Navigation Link with class "active"

Hello everyOne, first here
I have a custom theme with this code inside - navigation.html.twig

{% for link in site.links %} {% if link.url | contains('http') %} {% set domain = '' %} {% else %} {% set domain = base_url_absolute %} {% endif %} <li><a href="{{ domain }}{{ link.url }}" {% if link.url | contains('http') %}target="_blank"{% endif %}>{{ link.title }}</a></li> {% endfor %}

Inside a Grav theme default antimatter - navigation.html.twig

{% for page in pages.children.visible %} {% set current_page = (page.active or page.activeChild) ? 'active' : '' %} <li class="{{ current_page }}"> <a href="{{ page.url }}"> {% if page.header.icon %}<i class="fa fa-{{ page.header.icon }}"></i>{% endif %} {{ page.menu }} </a> </li> {% endfor %}

but this applied to my templates does not return anything…

It’s still not clear where is the problem is, but reinstalling the new GRAV based clean with Antimatter and then uploading my ftp theme > actived all works perfectly.
Obviously the skeletons used earlier has some setting that escapes me. :thinking:

If I find the setting that turns off page.active,
I’ll go back and tell it if it comes back to other people. :ok_hand:

Final :wink:

{% for page in pages.children %}

        {% set current_page = (page.active or page.activeChild) ? 'active' : '' %}
        <li class="*{{ current_page }}">
            {% if page.home %}
            <a href="{{ page.url }}">{{ 'Home' }}</a>
                
                {% else %}
            <a href="{{ page.url }}">
                {% if page.header.icon %}<i class="fa fa-{{ page.header.icon }}"></i>{% endif %}
                {{ page.title }}
            </a>
            {% endif %}
        </li>

    {% endfor %}
1 Like