# Optimize menus and submenus

- Check 02.05 · Architecture and navigation · Critical
- Source: https://checklist-seo-geo.com/en/architecture-navigation/optimize-menus-submenus
- Build crawlable, accessible menus and submenus that are identical on mobile: labels, HTML, mega menus and settings for each CMS.
- Updated on 2026-11-25
- Licence: CC BY 4.0. Credit “Checklist SEO & GEO” with a link to https://checklist-seo-geo.com/en/architecture-navigation/optimize-menus-submenus.
- Plugin checklist-seo-geo: 1.3.1 · https://github.com/maximegaul/checklist-seo-geo

## In short

The main menu is the only block of links present on every page: it tells visitors and search engines which sections matter. Optimizing it means choosing the right items and the right labels, then delivering a menu made of real HTML links, usable with the keyboard, and identical on mobile and desktop. Once the task is done, each main section is one click away from any page, and each subsection two clicks away.

## Why it matters

In its documentation on e-commerce site structure, Google explains that navigation (menus and links between pages) influences how it understands a site's structure, and recommends linking categories from the menus, then subcategories from the categories. A menu link is repeated on every page: it is the most massive internal signal you have.

Two technical conditions apply:

- **`<a href>` links.** Google generally only follows links of this type. Its bots do not click buttons and do not trigger JavaScript functions that require user action. A submenu that only exists in the page after a hover or a click is invisible to them.
- **The same menu on mobile.** Google indexes the mobile version of pages. If the mobile menu contains only five links when the desktop one contains forty, the others do not exist as far as indexing is concerned.

AI assistants' bots count too. A study published by Vercel and MERJ in December 2024 found that the main AI crawlers measured (including those of OpenAI, Anthropic and Perplexity) did not execute JavaScript, unlike Googlebot. A menu present in the initial HTML stays readable for all of them.

## What it improves

- **Crawling**: every section is one click away from every page.
- **Relative importance**: pages in the menu receive a link from across the whole site. An indirect effect on rankings.
- **Sitelinks**: Google generates them based on the site's structure; a clear menu contributes, with no guarantee.
- **Journey and conversion**: visitors find the offer without going through internal search.
- **Accessibility**: a menu usable with the keyboard and with a screen reader.
- **Reading by AI bots**: links and labels available without JavaScript. A plausible effect, not proven.

## How to check

**Are the links in the initial HTML?** Count the links present in the `<nav>` element of the raw source code:

```bash
curl -s https://example.com/ | tr '\n' ' ' | grep -o '<nav.*</nav>' | grep -o '<a [^>]*href="[^"]*"' | wc -l
```

Compare it with the number of items visible in the menu, submenus included. A much lower figure means the menu is built in JavaScript.

**Does the menu contain the same links on mobile?** Run the command again with a mobile user agent (`-A "Mozilla/5.0 (Linux; Android 14; Pixel 8) AppleWebKit/537.36 Mobile"`), or open the developer tools in device mode and inspect the collapsed menu. See [check internal linking parity](https://checklist-seo-geo.com/en/mobile-first-responsive-design/check-internal-linking-parity).

**Does it work with the keyboard?** Navigate with the Tab key: each item and each submenu must be reachable and visible on focus.

**Is it used?** Measure clicks on menu items (see “Measure and adjust”). Items that are never clicked and frequent internal searches reveal the labels to rework.

A compliant menu: about seven items at the first level, labels that make sense without knowing the company, each parent item leading to a real section page, submenus present in the HTML, the same content on mobile.

## How to implement

### Before you start

Content rules, valid for all environments:

1. **Start from the site tree.** Level 1 items are the main sections, the submenus their subsections. See [organize pages by topic and hierarchy](https://checklist-seo-geo.com/en/architecture-navigation/organize-pages-topic-hierarchy).
2. **Use your customers' words.** “Boilers” rather than “Heating solutions”, “Pricing” rather than “Offers”. Keyword research and the terms typed into internal search give you the right words.
3. **Limit the first level.** Around five to eight items stays readable; this is a rule of thumb from practice, not a search engine rule. Group the rest.
4. **Every parent item is a link.** “Green tea” must lead to the section page, and a separate button opens the submenu.
5. **A mega menu only if the catalog requires it**, with titled groups and only the subsections that matter, not every leaf of the tree.
6. **No duplicates.** The same page linked three times in the menu under three labels muddles the message.
7. **Utility links go elsewhere.** Legal notices, terms and conditions or careers go in the footer. See [optimize footer links](https://checklist-seo-geo.com/en/architecture-navigation/optimize-footer-links).

Examples:

| Site | Level 1 | Submenu example |
|---|---|---|
| Plomberie Garnier (tradesperson) | Boilers, Plumbing, Bathrooms, Emergency repairs, Pricing, Contact | Boilers: servicing, replacement, repairs, financial aid |
| Thé des Lisières (shop) | Green tea, Black tea, Herbal teas, Accessories, Gift sets, Guides | Green tea: sencha, matcha, genmaicha, Chinese green teas |
| Planifia (SaaS) | Features, Use cases, Industries, Pricing, Resources | Features: scheduling, route planning, mobile app, integrations |

Reference HTML structure, with submenus present in the page and a button that opens them:

```html
<nav aria-label="Main navigation" class="main-nav">
  <ul class="menu">
    <li class="menu-item">
      <a href="/the-vert/">Thé vert</a>
      <button type="button" class="submenu-toggle" aria-expanded="false" aria-controls="submenu-the-vert">
        <span class="visually-hidden">Thé vert submenu</span>
      </button>
      <ul class="submenu" id="submenu-the-vert">
        <li><a href="/the-vert/sencha/">Sencha</a></li>
        <li><a href="/the-vert/matcha/">Matcha</a></li>
        <li><a href="/the-vert/genmaicha/">Genmaicha</a></li>
      </ul>
    </li>
    <li class="menu-item"><a href="/guides/">Guides</a></li>
  </ul>
</nav>
```

```css
.submenu { display: none; }
.submenu.is-open { display: block; }

@media (hover: hover) and (min-width: 64em) {
  .menu-item:hover > .submenu,
  .menu-item:focus-within > .submenu { display: block; }
}

.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}
```

```js
document.querySelectorAll('.submenu-toggle').forEach((button) => {
  button.addEventListener('click', () => {
    const submenu = document.getElementById(button.getAttribute('aria-controls'));
    const isOpen = button.getAttribute('aria-expanded') === 'true';

    button.setAttribute('aria-expanded', String(!isOpen));
    submenu.classList.toggle('is-open', !isOpen);
  });
});
```

The submenus are hidden with CSS, but their links are in the HTML: bots read them. Without JavaScript, each parent item remains a link to its section page.

### WordPress

Versions: WordPress 6.4 and later.

- **Classic theme**: `Appearance > Menus`. Create the menu, add pages and categories, drag items to the right to make them sub-items, then assign the menu to the theme's primary location.
- **Block theme**: `Appearance > Editor > Navigation`. The Navigation block handles submenus and the mobile menu; submenus and the collapsed menu are rendered in the HTML by the server.
- **Short label**: in the Menus screen, each item's “Navigation Label” field (its label, in the Navigation block) lets you use a short label without changing the page title.
- **Mega menu plugins**: use the `curl` command from “How to check” to verify that the links are in the initial HTML and not loaded on hover.

### Shopify

Versions: Shopify admin, Online Store 2.0 themes, November 2026.

`Content > Menus`, open the main menu, add collections and pages, then drag items under a parent to create nested submenus. The theme displays this menu in the header; depending on the theme, the Header section of the theme editor (`Online Store > Themes > Customize`) lets you choose between a dropdown menu and a mega menu. Shopify themes render the menu in Liquid on the server side: the links are in the HTML.

### PrestaShop

Versions: PrestaShop 8 and 9, Main menu module (ps_mainmenu).

The main menu is managed by the “Main menu” module: `Modules > Module Manager`, search for it, then `Configure`. Add categories, CMS pages and custom links in the order you want. Subcategories appear under their parent category.

### Magento

Versions: Magento Open Source and Adobe Commerce 2.4, Luma theme.

The Luma theme's menu is built from the category tree: in `Catalog > Categories`, each category's “Include in Menu” option determines whether it appears, and the order of the tree sets the order of the menu. For links outside categories, use a CMS block or a menu extension, and check the HTML it produces.

### Drupal

Versions: Drupal 10 and 11.

`Structure > Menus > Main navigation` (`/admin/structure/menu/manage/main`). To display sub-items, tick “Show as expanded” on the parent item and set the number of levels displayed in the menu block configuration (`Structure > Block layout`).

### Wix

Versions: Wix Editor, November 2026.

The menu is managed in the editor's Pages & Menu panel; subpages are created by dragging one page under another. Check that the parent item points to a page and not to a mere folder title, which would have no URL.

### Squarespace

Versions: Squarespace 7.1, November 2026.

Main navigation pages are arranged in the Pages panel; folders create submenus. A folder has no page of its own: for a section that needs to rank, create a real section page and link it as the folder's first item.

### Webflow

Versions: Webflow Designer, November 2026.

Use the Navbar component with Dropdowns in which each item is a `Link`; Webflow publishes the menu as static HTML. For the parent item, add a link to the section page in the submenu, because the Dropdown toggle is not a link.

### Laravel

Versions: Laravel 11 to 13.

Generate the menu on the server side in a Blade component of the main layout:

```php
// app/View/Components/MainNav.php
namespace App\View\Components;

use Illuminate\Contracts\View\View;
use Illuminate\View\Component;

class MainNav extends Component
{
    public function render(): View
    {
        return view('components.main-nav', [
            'items' => [
                ['label' => 'Thé vert', 'url' => '/the-vert/', 'children' => [
                    ['label' => 'Sencha', 'url' => '/the-vert/sencha/'],
                    ['label' => 'Matcha', 'url' => '/the-vert/matcha/'],
                ]],
                ['label' => 'Guides', 'url' => '/guides/', 'children' => []],
            ],
        ]);
    }
}
```

```twig
{{-- resources/views/components/main-nav.blade.php --}}
<nav aria-label="Main navigation" class="main-nav">
    <ul class="menu">
        @foreach($items as $item)
            <li class="menu-item">
                <a href="{{ $item['url'] }}" @if(request()->is(trim($item['url'], '/'))) aria-current="page" @endif>{{ $item['label'] }}</a>

                @if($item['children'])
                    <button type="button" class="submenu-toggle" aria-expanded="false" aria-controls="submenu-{{ $loop->index }}">
                        <span class="visually-hidden">{{ $item['label'] }} submenu</span>
                    </button>
                    <ul class="submenu" id="submenu-{{ $loop->index }}">
                        @foreach($item['children'] as $child)
                            <li><a href="{{ $child['url'] }}">{{ $child['label'] }}</a></li>
                        @endforeach
                    </ul>
                @endif
            </li>
        @endforeach
    </ul>
</nav>
```

Call it with `<x-main-nav />` in the layout, and reuse the CSS and JavaScript from “Before you start”. If the menu comes from the database, cache the query.

### Next.js

Versions: Next.js 15 and 16 (App Router).

Put the menu in `app/layout.tsx` as a server component, with `Link`, which produces `<a href>` tags. Only the toggle button needs to be a client component:

```tsx
// app/components/main-nav.tsx (server component)
import Link from 'next/link'
import SubmenuToggle from './submenu-toggle'

const items = [
  { label: 'Thé vert', href: '/the-vert/', children: [
    { label: 'Sencha', href: '/the-vert/sencha/' },
    { label: 'Matcha', href: '/the-vert/matcha/' },
  ] },
  { label: 'Guides', href: '/guides/', children: [] },
]

export default function MainNav() {
  return (
    <nav aria-label="Main navigation" className="main-nav">
      <ul className="menu">
        {items.map((item, index) => (
          <li key={item.href} className="menu-item">
            <Link href={item.href}>{item.label}</Link>
            {item.children.length > 0 && (
              <SubmenuToggle id={`submenu-${index}`} label={item.label}>
                {item.children.map((child) => (
                  <li key={child.href}><Link href={child.href}>{child.label}</Link></li>
                ))}
              </SubmenuToggle>
            )}
          </li>
        ))}
      </ul>
    </nav>
  )
}
```

```tsx
// app/components/submenu-toggle.tsx
'use client'

import { useState, type ReactNode } from 'react'

export default function SubmenuToggle({ id, label, children }: { id: string; label: string; children: ReactNode }) {
  const [isOpen, setIsOpen] = useState(false)

  return (
    <>
      <button type="button" className="submenu-toggle" aria-expanded={isOpen} aria-controls={id} onClick={() => setIsOpen(!isOpen)}>
        <span className="visually-hidden">{label} submenu</span>
      </button>
      <ul id={id} className={isOpen ? 'submenu is-open' : 'submenu'}>{children}</ul>
    </>
  )
}
```

The submenu links, passed as `children`, are rendered by the server in the initial HTML. Do not display the submenu with conditional rendering (`{isOpen && <ul>…</ul>}`): when closed, it would disappear from the HTML.

### Measure and adjust

- **Google Tag Manager and Google Analytics**: create a “Click - Just Links” trigger, limited to clicks whose Click Element matches the CSS selector `nav[aria-label="Main navigation"] a`, and send a GA4 event with the label and URL clicked.
- **Click maps**: Microsoft Clarity, which is free, shows where visitors click, including in the open menu.
- **Internal search**: the most frequently typed terms show what the menu does not. See [test internal search](https://checklist-seo-geo.com/en/ux-conversion/test-internal-search).

Review the menu every six months, or with each new product line. Test a major label change over a few weeks before drawing conclusions.

## Common mistakes

- **Submenus generated on hover with JavaScript**: the links do not exist in the HTML and bots do not see them.
- **Parent item without a link** (`href="#"` or a plain button): the section has no page, or nobody reaches it through the menu.
- **Stripped-down mobile menu**: links removed from the mobile menu disappear from the indexed version.
- **Mega menu with two hundred links**: every page carries that many, visitors get lost and the signal gets diluted.
- **Internal or marketing labels** (“Universe”, “Our solutions”) instead of the words customers search for.
- **Links to URLs that redirect**: each menu item must point to the final, canonical URL.
- **Conditional rendering in frameworks**: the closed submenu is not in the DOM.

## Frequently asked questions

### Is a mega menu bad for SEO?

No, a mega menu is not harmful in itself. It becomes a problem when it contains hundreds of links repeated on every page, when its links are only loaded on hover through JavaScript, or when it is missing on mobile. An HTML mega menu, with titled groups and only the important subsections, actually helps visitors and search engines understand the site's main sections.

### How many links should go in the main menu?

Google and Bing set no figure. For readability, five to eight items at the first level is a rule of thumb from practice, and submenus only list the subsections that matter. Google only states that there is no ideal number of links per page, but that an excessive number eventually becomes counterproductive. Measure clicks and remove the items nobody uses.

### Does Google see the links in a collapsed hamburger menu?

Yes, if the links are present in the page's HTML, even when hidden with CSS until the menu is opened. Google extracts <a href> links from the page's code. However, if the hamburger menu only loads its links after a click, through JavaScript, Googlebot will not click and will not see them. Check the raw source code of the mobile version.

### Should the menu be different on mobile and desktop?

The presentation can differ; the content should not. Google indexes the mobile version of pages: links missing from the mobile menu do not exist as far as indexing is concerned. Keep the same items and submenus, collapsed into a hamburger menu or an accordion on mobile. If the desktop menu is too rich for a small screen, slim it down for everyone rather than cutting on mobile only.

## Resources

- [Google Search Central: Help Google understand your e-commerce site structure](https://developers.google.com/search/docs/specialty/ecommerce/help-google-understand-your-ecommerce-site-structure?hl=en)
- [Google Search Central: Link best practices](https://developers.google.com/search/docs/crawling-indexing/links-crawlable?hl=en)
- [MDN: the nav element](https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/nav)
- [WordPress: Navigation block](https://wordpress.org/documentation/article/navigation-block/) and [Menus screen](https://wordpress.org/documentation/article/appearance-menus-screen/)
- [Shopify: add navigation to your theme](https://shopify.dev/docs/storefronts/themes/navigation-search/navigation)
- [Vercel: the rise of the AI crawler](https://vercel.com/blog/the-rise-of-the-ai-crawler)
- [Nielsen Norman Group: mega menus](https://www.nngroup.com/articles/mega-menus-work-well/)

Next steps: [implement breadcrumbs](https://checklist-seo-geo.com/en/architecture-navigation/implement-breadcrumbs) and [optimize mobile menus](https://checklist-seo-geo.com/en/mobile-first-responsive-design/optimize-mobile-menus).
