Customizing The Header
Files: src/config/config.toml, src/layouts/components/global/header/ · Skill level: Beginner
Veltro has one shared header at src/layouts/components/global/header/Header.astro. src/layouts/Base.astro renders it on every page. To change the links, see Menus. For how the menu behaves, see Navigation.
In the Tina edition, the options below are under Site settings > Settings at /admin/. In the Sanity edition, they are under Site settings > Settings in the Studio. The labels are in Interface labels in both.
Header Position And Behavior
Base.astro accepts these, and a page file in src/pages/[...lang]/ sets them in code:
headerPosition?: "fixed" | "static" | "sticky";headerBorderOnScroll?: boolean;hideOffcanvas?: boolean;hideHeader?: boolean;headerPosition defaults to sticky. The second homepage turns on headerBorderOnScroll. hideHeader leaves the header out, for a page that brings its own top bar.
[settings] stickyHeader = truestickyHeader only matters on a page with headerPosition="static". Fixed and sticky headers always have the scroll behavior.
Navigation Action
[settings.navigationButton] enable = true label = "" url = "/contact/"When label is empty, Veltro uses navigation.buttonLabel from src/i18n/<lang>.json, so each language has its own.
The Two Panels
The header opens two different panels.
The contact side panel. The round action button opens SideMenu.astro, on every screen size. Its text comes from headerOffcanvas.description and the sideMenu keys in src/i18n/<lang>.json. Its contact details come from [settings.contactInfo] in config.toml, and its social links from src/config/social.json.
The mobile menu. The menu button opens the mobile menu, with the logo, the menu, and the navigation action:
[settings.headerOffcanvas] enable = true logo = ""enable turns the panel on and off, and logo replaces the logo in it. hideOffcanvas defaults to true, which keeps this panel on small screens unless a page passes hideOffcanvas={false}.
config.toml also has description and a [settings.headerOffcanvas.button] block. Nothing reads them on this theme, so changing them has no effect.
Language Switcher
The header shows LanguageSwitcher.astro when multilingual support is on. The list of languages comes from src/config/language.json. See Internationalization.
Files
| File | What it does |
|---|---|
header/Header.astro | The header bar and its options |
header/Navbar.astro, header/MenuItem.astro | The menu |
header/NavStage.astro, NavStageDropdown.astro, NavStageList.astro, NavStageMega.astro | The desktop dropdown panel |
header/DropdownMenu.astro, header/MegaMenu.astro, header/NavbarToggler.astro | The mobile menu |
header/SideMenu.astro | The contact side panel |
header/LanguageSwitcher.astro | The language switcher |
All of these are under src/layouts/components/global/. The mobile panel itself is src/layouts/components/widgets/HeaderOffcanvasContent.astro.