When I'm running a standard search, for example /search?q=querystring
the available urls are pointing to the root:
// dump of the twig url variable:
array:1 [▼
"de" => "/"
]
This is causing my menu to highlight the home link, which is of course not correct ;) - Is there a good way to distinguish the search page from the actual frontpage?
This looks like a bug for me but you can use path
variable to check if its actually a page template e.g.
{% if path is defined %}
Don't let the content of the path variable confuse you its the location of the content page in the phpcr tree so it does not represent a url. In some cases it does match the url. In most cases the path variable is a good way to check if a page is a child of another page also if you use other resourcelocator strategies as the default tree one.
e.g. if you create a navigation:
{% for page in sulu_navigation_root_tree('main') %}
{% set addClass = '' %}
{% if page.path starts with path|default() %}
{% set addClass = 'is-active-parent' %}
{% elseif page.uuid == uuid|default() %}
{% set addClass = 'is-active' %}
{% endif %}
{# ... #}
{% endfor %}