Meta menu / Footer menu in TYPO3
A meta menu - often but not always displayed in the footer of a website - displays only selected pages like "Imprint", "Contact", "Data Privacy", ...
If you use a Generated site package it already contains a meta menu in the footer of the page.
To display a breadcrumb the menu data processor can be used with the special type List or Directory.
The special menu type "List" allows you to specify a list of UIDs of pages that should be displayed in the meta menu. The special menu type "Directory" allows you to specify a folder or page of which all subpages should be displayed in the menu. We take the second approach here.
Menu of subpages TypoScript - the data processor
Line 4: Each data processor must have a unique id. We used 10 for the page-content data processor and 20 for the Main menu and 30 for the Breadcrumb therefore we now use 40.
Line 6: The values processed by the data processor should be stored in variable
footer
.
Line 7: We configure the menu to use the special type Directory.
Line 8: The folder which contains the pages to be displayed in the footer menu
can be configured via site settings. You can find the definition of this setting
in file packages/
.
Menu of subpages - Fluid template
The special type directory
delivers the items of the meta menu as an array.
Therefore we can use the For ViewHelper <f:for>
to loop through these elements:
<ul class="nav col-md-4 justify-content-end">
<li class="nav-item"><a href="#" class="nav-link px-2 text-body-secondary">Data privacy</a></li>
<li class="nav-item"><a href="#" class="nav-link px-2 text-body-secondary">Imprint</a></li>
</ul>
The menu items can be displayed just as we have done in the Fluid partial of the main menu.
As we do not need to highlight active pages in the footer menu we omit those conditions.
Switching to the menu type list
If it is more feasible for your project to list all pages that should be listed in the meta menu, you can switch to using the special menu type "List" by changing the TypoScript:
40 = menu
40 {
as = footerMenu
- special = directory
+ special = list
special.value = {$MySitePackage.footerMenuRoot}
}
You can now change the setting to accept a comma separated list of integers and then list all pages that should be displayed in the meta menu. For example:
MySitePackage.footerMenuRoot:
label: 'Footer menu root uid'
- description: 'The subpages of this page are displayed in the footer'
+ description: 'These pages are displayed in the footer'
category: MySitePackage.menus
- type: int
+ type: stringlist
- default: 2
+ default:
+ - 5
+ - 4
+ - 3
We are using the type stringlist - as of writing these lines - there is no integer list type in the settings yet.