Reply to comment

Drupal 8: Add menu item with anchor link programmatically in .menu.yml

For a Drupal 8 EU Cookie Compliance patch I needed a way to add an anchor link as default menu item programmatically in .menu.yml

title: "Anchor example"
description: "Scroll to top on the current page"
url: "internal:#top"

See my addition in documentation:

Thanks to the comments in
and which helped me a lot to find this solution.


The content of this field is kept private and will not be shown publicly.

More information about formatting options