# Customizing Header

## Customizing the Header

**Files:** `src/config/config.toml`, `src/config/menu.<lang>.json`, `src/i18n/<lang>.json`, `src/layouts/components/global/header/` · **Skill level:** Beginner

In the Tina edition, these are **Menus**, **Site settings**, and **Interface labels** at `/admin/`, and every page's form has a **Header layout** field. In the Sanity edition, they are **Menus** and **Interface labels** under your language in the Studio, and **Site settings > Settings**. Which header a page uses stays in code.

Techbyte includes two header layouts and several configurable header features:

- **Logo** – [Update your site's logo](../site-identify-logo/)
- **Menus** – [Organize and manage navigation menus](../menus/), and see [Navigation](../../features/navigation/) for how they behave
- **Language switch** – [Add or remove languages](../internationalization/)
- **Navigation Button** – The button in the header.
- **Top Bar** – The strip above the header.
- **Announcement Bar** – A message in Header 2's top bar.
- **Side Menu** – A slide-in panel with about text, contact details, and a button.
- **Small-Screen Menu Panel** – The slide-in panel that holds the menu on small screens.

### Choosing a Header Layout
Every page renders through `src/layouts/Base.astro`, which accepts a `headerLayout` prop:

```astro
// src/pages/[...lang]/home-two.astro
<Base {...page?.data} headerLayout="header-2">
  <!-- page sections -->
</Base>
```

`headerLayout` accepts `"header-1"` (the default) or `"header-2"`. They render `Header.astro` and `HeaderTwo.astro` in `src/layouts/components/global/header/`. Only Home 02 uses `header-2`.

See [Header & Footer Variants](../header-footer-variants/) for a full breakdown of what each layout changes.

### Sticky Header Behavior
This is controlled globally from `config.toml`:

```toml
# src/config/config.toml
[settings]
  stickyHeader = true
```

When it is `true`, the header stays at the top of the window while you scroll, and gets a solid white background once the page has scrolled.

`Base.astro` also takes a `headerPosition` prop (`sticky` by default, `fixed`, or `static`). No page in the theme sets it, so try it in a browser before you rely on it.

### Customizing the Navigation Button
Open `src/config/config.toml` and locate the following section:

```toml
[settings.navigationButton]
  enable = true
  label  = ""
  url    = "/contact/"
```

If `label` is left empty, the button label comes from `navigation.buttonLabel` in the language file, such as `src/i18n/en.json`. That way, each language has its own label. A value here shows on every language.

```json
"navigation": {
  "buttonLabel": "Start a Project"
}
```

The button shows on large screens.

### Announcement Bar (Header 2)
Header 2's top bar can show an announcement message, configured under `settings.announcementBar`:

```toml
[settings.announcementBar]
  enable = true
  label  = ""
```

If `label` is empty, Techbyte uses `header.announcement` from the language file (which supports inline Markdown links). Set `enable = false` to hide it. Header 1's top bar doesn't show it.

### Customizing the Top Bar
The phone number in the top bar comes from the global contact info. This is also where the address, email, and map link live:

```toml
# src/config/config.toml
[settings.contactInfo]
  address = "125 Market Street, Suite 420, San Francisco, CA 94105"
  email   = "hello@example.com"
  phone   = "+1 415 555 0198"
  mapLink = "https://www.google.com/maps?q=San+Francisco,CA&output=embed"
```

- **Header 1:** `common.hotLine` from the language file with the phone number, your [social links](../social/), and the language switch.
- **Header 2:** the same label and phone number, the announcement, and the language switch.

### Side Menu
Both headers have a side menu button: two lines beside the logo in Header 1, and at the end of the header in Header 2. It opens a slide-in panel (`SideMenu.astro`) with an about text, a button, your contact details, and your social links. The panel's text comes from the `sideMenu` object in the language files:

```json
"sideMenu": {
  "aboutTitle": "About Techbyte",
  "aboutDescription": "We provide managed IT support, cloud consulting...",
  "contactTitle": "Contact Us",
  "button": { "label": "Contact Us", "url": "/contact/" }
}
```

### Small-Screen Menu Panel
On small screens, the menu button opens a panel with the logo, a description, the menu, your contact details, your social links, and a button. It is configured under `settings.headerOffcanvas` in `config.toml`:

```toml
[settings.headerOffcanvas]
  enable      = true
  logo        = "/images/logo.png"
  description = ""

  [settings.headerOffcanvas.button]
    enable = true
    label  = ""
    url    = "/contact/"
```

Empty `description` and `label` values use `headerOffcanvas.description` and `headerOffcanvas.buttonLabel` in the language file. The panel shows the `[site]` logo, so the `logo` key here isn't used.

Leave `enable` on: this panel is the only menu on small screens, so `enable = false` leaves phones with no menu.

### Do It With AI
```text
Change the header button to "[LABEL]", linking to [URL]. In each file in src/i18n/, set
navigation.buttonLabel to the label in that file's language. In src/config/config.toml, set url under
[settings.navigationButton] and keep label empty. Don't change the header components. Then run
npm run astro-check.
```