Determine main menu item on front page updating menu--main.html.twig I am trying to write a custom twig for menu--main.html.twig under Drupal 8.3.  When in the menu_links macro while on the home page, the item.in_active_trail is not TRUE.  I tried to compare the path('') to item.url but it never returns true.  I can print out both path('') and item.url and see that they output the same exact text (character for character).  Is there a special way to determine if the item.url is the front page or to string compare URL strings?

{{ path('&lt;front&gt;') == item.url ? 'true' : 'false' }} ==&gt; 'false'
{{ path('&lt;front&gt;') }} ==&gt; '/drupal8_test/'
{{ item.url }} ==&gt; '/drupal8_test/'
To get the path from item.url you would have to use the method toString():

  {{ item.url.tostring }}


Instead of comparing strings a better approach might be to check for the route name of the frontpage:

  {% if item.url.routed and item.url.routename == '&lt;front&gt;' %}
    &lt;em&gt;Front Page&lt;/em&gt;
  {% endif %}