Dynamic Navigation with Condition to check slug I'm trying to achieve one pretty simple thing, but putting it into my dynamic nav is making it a little difficult. I want to have a little number of the total amount of entries in my channel "listings" and keep it on one of the links "Our Properties".



I currently have this code that is displaying the total amount of entries

{% set totalListings = craft.entries.section('listings').total() %}
{{ totalListings }}


How can I make this work: {% if link == "properties" single entry %} {{ totalListings}} {% endif %}

{% set menu = craft.entries.section('navigation') %}
&lt;ul&gt; 
    {% nav link in menu.all %}
        &lt;li {% if craft.app.request.absoluteUrl == link.addentry[0].url %} class="active"{% endif %}&gt;
           &lt;a href="{{ link.addentry[0].url }}"&gt;{{ link.title }}&lt;/a&gt;
        &lt;/li&gt;
    {% endnav %}
&lt;/ul&gt;
Got it to work! I don't know why I made it so complicated in my head, but I ended up using the link id to match with the properties link.

{% nav link in menu.all %}
    &lt;li {% if craft.app.request.absoluteUrl == link.addentry[0].url %} class="active"{% endif %}&gt;
        &lt;a href="{{ link.addentry[0].url }}"&gt;{{ link.title }}{% if link.id == 15 %}&lt;span class="exposant"&gt;{% set totalListings = craft.entries.section('listings').total() %}{{ totalListings }}&lt;/span&gt;{% endif %}&lt;/a&gt;
    &lt;/li&gt;
{% endnav %}


If someone can show me how to get it by slug that would be awesome! Thanks &amp; hope this will help someone in the future.