How to Import and Export Menu Items in Drupal Using Menu Export/Import

Menu Export/Import allows site builders to import and export menu structures using a simple JSON style notation. The module helps site builders to create, test and deploy menu structures without having to re-enter menu items over and over again – you will save a lot of time using this module.

Here is an example of the notation. You can indent menus with either a “*” or “-” character there is no difference between one or the other.

If you need a menu item to point to an existing page or node, simply add “URL and the path” after the menu name on the same line. For example, “contact url contact” (Contact {"url":"contact"} ) will create a menu item called Contact and set the path to slash content (/contact). When a URL is not specified, then the menu item URL is automatically set to front (<front>) which is the homepage.

In this video, we’ll look at how you can import and export menus via Drupal’s administration section and via Drush.

Module

drush dl menu_import

Resources

Example menu item list used in video:

Home
News
- Drupal
-- Drupal 7
-- Drupal 6
- PHP
Contact
- About Us

Drush commands used in video:

drush menu-export main-drush-export.txt main-menu --line-ending=mac

drush menu-import main-menu.txt main-menu --clean-import

Scroll to Top