Drupal - Export menu configuration

Menu links can come from 3 sources:

  • Views module (these can be exported when the view config is exported)
  • .links.yml file in a module (not possible to export)
  • Created menu links (Is content entities, like nodes, users, etc and is not possible to export)

I'm guessing you are creating menu links via interface, which is content. The config system can't export content, which is by design. If you wanted to synchronize content, you would need to look at the Deploy module suite. I'm not sure how well this is working atm, since it's still in alpha.


Check the Config Menu Link module.


My experience with Drupal 8 step by step

First of all, you need to install Menu Export module and activate it. After that, you will have Export Menu in the Structure part.

Steps to Export & Import

1- In the Export Menu page domain.com/admin/config/development/menu_export, you have three option, at Menu list select which menus you want to export.

2- On the Export section, export your menus.

(In this step menu setting will not be exported on YML file then you need to continue.)

3- Now you need to export system configuration from domain.com/admin/config/development/configuration/full/export or drush cex

Note: after export, you will have menu_export.export_data.yml file that contains your menu settings

4- Transfer configuration anywhere you want, then you need to import them from domain.com/admin/config/development/configuration/full/import or drush cim

5- Then you need to import menus to your system from UI domain.com/admin/config/development/menu_export/import

Important Note

Clear your cache

In some cases, mostly with Administration menu you need do and extra step. That you need to just open the edit Administration menu page and just saving it without any changes after this you should see your updated menu on administration as well.