Skip to content
New: Customize your theme with an AI assistant. Read the guide

Customizing The Header

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

In the Tina edition, the header settings are under Site settings > Settings, the menu under Menus, and the text under Interface labels at /admin/. In the Sanity edition, they are under Site settings > Settings, and your language’s Menus and Interface labels in the Studio.

Taxo has two header layouts:

  • header-1 uses Header.astro
  • header-2 uses HeaderTwo.astro

The base layout default is header-2, but the main homepage explicitly uses header-1. For how the menu itself behaves, see Navigation.

Where Header Layouts Are Chosen

src/layouts/Base.astro
const defaultHeader = "header-2";
const resolveHeader = headerLayout || defaultHeader;
src/pages/[...lang]/index.astro
<Base {...page?.data} headerLayout="header-1">

In the Tina edition, each page’s form also has a Header layout field. Leave it empty to keep the page’s usual layout. In the Sanity edition, the layout a page uses stays in its page file.

Header 1 Structure

src/layouts/components/global/header/Header.astro renders:

  • TopBar.astro
  • logo
  • headerPrimary navigation
  • optional navigation CTA button
  • optional offcanvas toggle

TopBar.astro includes:

  • working hours label from common.workingHours and common.workingHoursValue in src/i18n/<lang>.json
  • phone chip from settings.contactInfo.phone
  • language switcher when multilingual is enabled
  • the first 4 enabled links from src/config/social.json

Header 2 Structure

src/layouts/components/global/header/HeaderTwo.astro renders:

  • TopBarTwo.astro
  • accent logo block
  • headerPrimary navigation
  • phone block from settings.contactInfo.phone, which links to settings.navigationButton.url
  • optional offcanvas toggle

TopBarTwo.astro includes:

  • hotline block from settings.contactInfo.phone
  • announcement bar text
  • language switcher

Header Settings Inconfig.toml

[settings]
stickyHeader = true
[settings.navigationButton]
enable = true
label = ""
url = "/contact/"
[settings.announcementBar]
enable = true
label = ""
[settings.headerOffcanvas]
enable = true
logo = "/images/logo-light.svg"
description = ""
[settings.headerOffcanvas.button]
enable = true
label = ""
url = "/contact/"

Shared Text Sources

When a label is empty in config.toml, Taxo falls back to the language’s file in src/i18n/, such as en.json, fr.json, or ar.json:

{
"navigation": {
"buttonLabel": "Get in Touch"
},
"header": {
"announcement": "Get Your Free Tax Advisor Today..."
},
"headerOffcanvas": {
"description": "We are a digital agency...",
"buttonLabel": "Let's Talk With Us"
}
}

Both header layouts use the same menu data:

src/config/menu.en.json
{
"headerPrimary": []
}

That means a menu change affects:

  • header 1 desktop navigation
  • header 2 desktop navigation
  • the mobile offcanvas navigation

Show Or Hide The Desktop Offcanvas

Base.astro sets hideOffcanvas to true by default, which keeps the offcanvas toggle mobile-only. If you want the desktop offcanvas button visible on a page, change the page file:

<Base {...page?.data} hideOffcanvas={false}>
Type something to search...