Skip to the content
Documentation
Help Start
Reading in:
  • German: 9,059 of 9,059 pages
About the help in other languages
All help pages

Header menu by command line

Add a page to the header menu with ./console exp:ini - see where the list is set, preview the change with --dry-run, write it, clear the caches. Real output from Exponential 6.0.15+.

Download as PDF

Address: https://doc.exponential.earth/exphelp/viewer/help/build-two-ways/header-menu-by-cli.md

On this page

Header menu by command line

Two commands add a page to the header menu: exp:ini add writes the node ID into menu.ini, exp:cache clear makes the site show it. Run them in the installation's root directory. As root, add --allow-root-user to every command (the output below was made that way; the option is left out of the prompts for readability).

Contents

  1. See where the list is set
  2. Preview the change
  3. Write it
  4. Clear the caches
  5. Check the result
  6. The same for every siteaccess

1. See where the list is set

exp:ini where lists every file that sets a setting, in the order they are read, and the value in effect:

$ ./console exp:ini where menu.ini/SiteInfo/MainMenuID site
menu.ini/SiteInfo/MainMenuID (load order of siteaccess site)
 1. extension/sevenx_themes_media/settings/siteaccess/site/menu.ini.append.php scope extension:sevenx_themes_media:siteaccess:site
      MainMenuID[]=79
      MainMenuID[]=117
      MainMenuID[]=131
      MainMenuID[]=150
      MainMenuID[]=151
 2. settings/siteaccess/site/menu.ini.append.php                 scope siteaccess:site
      MainMenuID[]=92
      MainMenuID[]=130
      MainMenuID[]=144
      MainMenuID[]=163
      MainMenuID[]=164
      MainMenuID[]=26210
      MainMenuID[]=192
In effect:
      MainMenuID[]=92
      ...

The second file (scope siteaccess:site) is the one in effect, so that is the scope to write. (This listing already has 192, added in the administration on the other page.)

2. Preview the change

--dry-run shows the change as a diff and writes nothing. The example adds Contact (node 185):

$ ./console exp:ini add menu.ini/SiteInfo/MainMenuID[] 185 siteaccess:site --dry-run
--- a/settings/siteaccess/site/menu.ini.append.php
+++ b/settings/siteaccess/site/menu.ini.append.php
@@ -10,6 +10,7 @@
 MainMenuID[]=164
 MainMenuID[]=26210
 MainMenuID[]=192
+MainMenuID[]=185
 NexusMainMenuID[]
 NexusMainMenuID[]=167
 NexusMainMenuID[]=168
Dry run: add to menu.ini/SiteInfo/MainMenuID[] in siteaccess:site, nothing written

add appends: the new item becomes the last one. For another position, see Reorder or remove header menu items.

3. Write it

$ ./console exp:ini add menu.ini/SiteInfo/MainMenuID[] 185 siteaccess:site
Add to menu.ini/SiteInfo/MainMenuID[] in siteaccess:site: settings/siteaccess/site/menu.ini.append.php
Backup: var/backup/ini/20261019-031440/settings/siteaccess/site/menu.ini.append.php
INI cache: cleared tag ini: 5 caches
Hint: PHP-FPM reads the change on its next request (ini cache cleared); Velocity workers keep the settings of their warm-up: exp:velocity restart to apply it there.
Done

The file is written line by line (comments and order stay), atomically, after a backup copy under var/backup/ini/. The INI cache is cleared. As the hint says, a site served by Exponential Velocity applies the change after ./console exp:velocity restart.

4. Clear the caches

The header's menu template is compiled with the list of IDs in it, so clear the template and content caches:

$ ./console exp:cache clear --tag=template,content
  exphttpcache         on  content,template           new HTTP cache generation: every stored page becomes stale
  template             on  template                   directory removed
  template-block       on  template,content           expiry timestamp global-template-block-cache set, directory moved aside
  template-override    on  template                   directory removed, in-memory override list emptied
  ...
  content              on  content                    expiry timestamp content-view-cache set, directory moved aside
  ...
PASS  cleared tag template, content: 17 caches

5. Check the result

The menu items carry the attribute id="menu-item-main_menu-location-id-<id>", so a quick check is:

$ curl -s https://www.example.com/ | grep -o 'menu-item-main_menu-location-id-[0-9]*' | tail -3
menu-item-main_menu-location-id-26210
menu-item-main_menu-location-id-192
menu-item-main_menu-location-id-185

(On this site the first five items show the IDs from NexusMainMenuID[] in that attribute instead, see How the header is built.)

6. The same for every siteaccess

Each site siteaccess can have its own list. To find all of them: ./console exp:ini scopes lists the scopes the installation has, and exp:ini where menu.ini/SiteInfo/MainMenuID <siteaccess> shows the list in effect for one of them. Write each one with its own scope, siteaccess:<name>. The scope global (settings/override/menu.ini.append.php) is read after every siteaccess file, so a value added there is added to the list of every siteaccess; keep menu lists in the siteaccess files, where each site has its own.

Become an Exponential Partner

Partners share their information, provide funding, contribute back and develop the products with us, and that is how Exponential grows. A partner website and dashboard are planned for mid-2027: please become a partner today to speed up our growth rate and land new features faster.

Something wrong on this page? Report an error

Documentation license

This documentation is free documentation, licensed under the GNU Free Documentation License 1.3 or later.

Exponential Copyright © 1998-2026 Exponential Foundation and 7x