U may look how the theme is initializing the smoothscroll.js. Maybe it already supports the slug: variable of the frontmatter which u can serve a different slug. So try to define a slug. If not u can easily add this support and use the title as a fallback.
{% if page.header.slug %} USE SLUG AS ID {% else %} USE TITLE AS ID {% endif %}
or create id from this statement {{ page.header.slug? page.header.slug : page.header.title }}
Hi npetri,
thanks for the hints i gonna try it and leave a comment. The theme im using is bootrap 4. There is no native smoothcroll.js included.
Thanks pgrav
hi npetri
when i place a slug: uebermich in the header so whole page is not shown. Strange
I had a look in partials/base.html.twig as well in modular.html.twig (because its a onepager) and the navigation.html.twig but can’t find where/how the slug is created.
The description of ur problem was way too short. It lacks the part that u r in a context of a modular. But yea u found a solutiuon. U can create any variable in frontmatter and use it for ur purpose. The slug is a special one and u can refer a page by name and slug and i think a decent theme will take care of that. Thats why i suggest to try slug.
Btw, there was no need to change the twig file if u set the menu variable in the frontmatter like u set the anchor variable.