My Q is equal as Remove link from active page in menu
I need the active page in my menu not to be a link.
So let's say I'm on the services page, I need my menu structure to look like this:
<ul class="menu"> <li class="first leaf"><a href="/mysite/">home</a></li> <li class="leaf">services</li> <li class="leaf"><a href="/mysite/portfolio">portfolio</a></li> <li class="leaf"><a href="/mysite/contact">contact</a></li> </ul>
How can I do that in drupal 8?
Update what about this thing in my theme menu--main.html.twig?
{% if item.attributes.hasClass('active') %}
<span>{{ item.title }}</span>
{%- else -%}
{{ link(item.title, item.url) }}
{%- endif -%}