I have a menu with a "Home" link which was "provided by the Standard module. The title and path cannot be edited."

I am trying to alter the text/link using my module's links.yml file like so:

  title: 'Home Test'
  route_name: '<front>'
  menu_name: main

However this has no affect on the menu link. Other entries in this file work just fine.

Is it possible to alter the link in this way, or is the only option to use one of the menu hooks such as hook_menu_links_discovered_alter

  • do you found the solution? Feb 12, 2018 at 16:23
  • Thank you, your answer was correct. It wasn't working at first due to a permissions problem. I was just hoping it could be changed directly in the yml links file. Feb 12, 2018 at 16:36

1 Answer 1


I usually use this the hook_menu_links_discovered_alter() in this way:

 * Implements hook_menu_links_discovered_alter().
function YOUR-MODULE-NAME_menu_links_discovered_alter(&$links) {
   // Changing the title.
   $links['standard.front_page']['title'] = 'Hi';
   // Changing the route.
   $links['standard.front_page']['route_name'] = 'block.admin_display';

But it seems that there are another ways in How to update a menu link created with MenuLinkContent::create()? and How do I programmatically update or delete menu items?

  • Using this hook you can alter the 'main' menu items like standard.front_page (Home) and you can't do that in your hook_install implementation. Please see this answer for more about this drupal.stackexchange.com/a/189471/50538 Apr 2, 2022 at 16:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.