How to set Home page menu as active when slug is not defined in admin panel? Is their is any way to set active class to a page when slug is not define?
craft.request is useful for setting an &quot;active&quot; class based on URL segments without slug.
In your template you can set a slug in twig and then you can run if statement to check what the segment is. Check below example for that.
&lt;ul&gt;
    {% set slug = craft.app.request.getSegment(1) %}                        
    {% for entry in entries %}
        {% set destination = entry.linkDestination.one() %}
        &lt;li {% if slug == destination.slug or (destination.slug == 'home' and slug == null) %} class=&quot;active&quot; {% endif %}&gt;
            &lt;a href=&quot;{{ destination.url }}&quot;&gt;&lt;span&gt;{{ entry.linkText }}&lt;/span&gt;&lt;/a&gt;
        &lt;/li&gt;
    {% endfor %}   
&lt;/ul&gt;