# Menus

## Menus

**Files:** `src/config/menu.<language>.json` · **Skill level:** Beginner

The header menu and the footer link columns live in one JSON file per language: `menu.en.json`, `menu.fr.json`, and `menu.ar.json`. Keep the files in the same shape: same items, same order, same URLs. Only the `name` and `label` texts differ.

In the Tina edition, edit **Menus and footer columns** at `/admin/` and pick `menu.en`, `menu.fr`, or `menu.ar`. The lists are **Header Primary** and **Footer**, and `weight` is called **Order**. Its form has fields for four levels, counting the top item. In the Sanity edition, the files don't exist: open Content, your language, **Menus**, then **Header menu** or **Footer columns**. There, `enable` is **Show**, `name` is **Label**, `weight` is **Order**, and `url` is **Link**.

Each file has two lists:

```json
{
  "headerPrimary": [ ... ],
  "footer": [ ... ]
}
```

For how the menu behaves on screen and with the keyboard, see [Navigation](../../features/navigation/).

### Header Menu
Each item in `headerPrimary` is one entry in the top menu. There are three kinds of item.

**A plain link** (Plumbo's top items are all menus, but a link is one line):

```json
{ "enable": true, "name": "Contact", "weight": 7, "url": "/contact/" }
```

**A dropdown.** Set `"hasChildren": true` and list the links in `children`. This is the **Areas** menu, trimmed:

```json
{
  "enable": true,
  "name": "Areas",
  "weight": 3,
  "hasChildren": true,
  "children": [
    { "enable": true, "name": "North Harbor", "url": "/areas/north-harbor/", "weight": 1 },
    { "enable": true, "name": "All areas (4)", "url": "/areas/", "weight": 5 }
  ]
}
```

**A mega menu.** Set `"hasMegaMenu": true` and list groups of links in `menus`. This is the **Services** menu, trimmed:

```json
{
  "enable": true,
  "name": "Services",
  "weight": 1,
  "hasMegaMenu": true,
  "menus": [
    {
      "enable": true,
      "name": "Plumbing repairs",
      "weight": 1,
      "children": [
        {
          "enable": true,
          "name": "Leak detection",
          "description": "Hidden leaks found without opening every wall",
          "icon": "Droplet",
          "url": "/services/leak-detection/",
          "weight": 1
        }
      ]
    }
  ],
  "cta": { "enable": true, "eyebrow": "Upfront prices", "image": "/images/services/pipe-repair-at-work.jpg", "title": "Your price in writing before work starts", "description": "...", "items": ["..."], "button": { "enable": true, "label": "Book a plumber", "url": "/book/", "variant": "fill" } },
  "bar": { "enable": true, "text": "Water leaking right now? We answer 24/7.", "label": "All services", "url": "/services/" }
}
```

| Key           | What it does                                                                                     |
| ------------- | ------------------------------------------------------------------------------------------------ |
| `enable`      | `false` hides the item without deleting it                                                       |
| `name`        | The text in the menu                                                                             |
| `weight`      | A position number. Plumbo shows items in the order of the file and doesn't sort by this number, so move an item in the file to move it in the menu |
| `url`         | Where it links. Write paths without the language: `/pricing/`, not `/fr/pricing/`. The other languages add their prefix themselves. An item with children has no `url` |
| `hasChildren` | `true` makes the item a dropdown                                                                 |
| `children`    | The links inside the dropdown. A child with its own `hasChildren` and `children` opens a flyout  |
| `hasMegaMenu` | `true` makes the item a mega menu                                                                |
| `menus`       | The columns of a mega menu, each with `enable`, `name`, `weight`, and `children`. The `name` is a heading, not a link |
| `bar`         | The row along the bottom of a mega menu, with `enable`, `text`, `label`, and `url`. It also shows your phone number from `[business]` |
| `cta`         | An optional photo card in a mega menu: `eyebrow`, `image`, `title`, `description`, a short `items` list, and a `button`. The Services menu ships with one. `"enable": false` hides it |
| `class`       | Extra classes for the item. `"hidden xl:flex"` hides **Company** below 1320 px, where the bar runs out of room. Every Company link is also in **Pages**, so nothing goes missing |

<Aside type="caution" title="New services and areas don't appear on their own">
  The header menu is plain data. When you add a service or an area, add its link
  to the **Services** or **Areas** menu in every language. The count in **All
  areas (4)** is ordinary text, so update it too.
</Aside>

### Flyouts
A child that has its own `hasChildren` and `children` opens a flyout to the side, and it flips if there is no room. The **Pages** menu uses this to list every page of the theme:

```json
{
  "enable": true,
  "name": "Pages",
  "weight": 6,
  "hasChildren": true,
  "children": [
    {
      "enable": true,
      "name": "Homepages",
      "weight": 1,
      "hasChildren": true,
      "children": [
        { "enable": true, "name": "Main homepage", "url": "/", "weight": 1 },
        { "enable": true, "name": "Residential plumbing", "url": "/home-residential/", "weight": 2 }
      ]
    }
  ]
}
```

You can nest as deep as you like. On phones, the same levels open as lists inside the mobile menu.

<Aside type="tip" title="Hide the Pages menu on your site">
  **Pages** is a catalog of the demo: it links to the four homepages, the
  sample detail pages, and `/elements/`. Set its `"enable"` to `false` in every
  menu file before you launch, and remove `"class": "hidden xl:flex"` from
  **Company**, so its links show at every desktop width.
</Aside>

### Footer Menus
`footer` is a list of link columns. Each has a `label` (the column heading) and a `list` of links:

```json
"footer": [
  {
    "label": "Services",
    "list": [
      { "enable": true, "name": "All services", "url": "/services/" },
      { "enable": true, "name": "Leak detection", "url": "/services/leak-detection/" }
    ]
  },
  {
    "label": "Areas",
    "source": "areas",
    "list": [{ "enable": true, "name": "All areas", "url": "/areas/" }]
  },
  {
    "label": "Legal",
    "list": [
      { "enable": true, "name": "Terms", "url": "/terms-conditions/" },
      { "enable": true, "name": "Privacy policy", "url": "/privacy-policy/" },
      { "enable": true, "name": "Cookie settings", "url": "#cookie-settings" }
    ]
  }
]
```

The shipped file has five columns: **Services**, **Company**, **Help**, **Areas**, and **Legal**. Two rules matter:

- **The last column holds the legal links.** Every footer layout shows it in its bottom row, next to the copyright, instead of as a column. Keep Legal last.
- **`"source": "areas"`** lists your service areas first, then the column's own links ("All areas"). It is the only menu that fills itself. The `large` footer turns this column into a row of areas. In the Tina form this field is **Source**, and in the Studio it is **Fill from**.

Each footer layout uses the columns a little differently: `default` puts the first column (Services) in two columns beside your contact details, `minimal` shows the first two, and `columns` shows up to three link columns plus your contact details. See [Footer & CTA Band](/plumbo/customization/footer/).

The **Cookie settings** link (`#cookie-settings`) reopens the cookie banner. If you turn the banner off in `[settings.cookieConsent]`, set this item's `enable` to `false`.

### Keep Every Language In Step
`npm run check-i18n` (also part of `npm run astro-check`) compares each language's menu file with `menu.en.json` and reports a difference in the number of items, a `url`, or a `source`. So when you add, remove, or move a menu item, do it in every file.

JSON is strict: every item but the last in a list needs a comma after it, and every name and URL needs double quotes. A missing comma stops the site from building. See [File Formats](/plumbo/beginner/file-formats/).

### Do It With AI
```text
In each src/config/menu.<language>.json: set "enable": false on the "Pages" item in headerPrimary
and remove "class": "hidden xl:flex" from the Company item, remove [ITEMS] from the Company dropdown, and add a link "[NAME]", translated for each language, to
[URL] after Pricing. In the footer, make the Services column list only: [SERVICES]. Keep the Legal
column last and the Areas column's "source": "areas". Keep every file in the same structure, then
run npm run check-i18n.
```