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
The Folex header holds these parts:
- Logo: update your site’s logo.
- Menu: edit the menus. For dropdowns, nested flyouts, mega menus, and keyboard support, see Navigation.
- Language switch: manage your languages. It doesn’t show on blog category and tag pages.
- Navigation button: see below.
- Side panel button: the round button that opens the side panel. See below.
In the Tina edition, edit these in Site settings > Settings, Menus, and Interface labels at /admin/. In the Sanity edition, they are in Site settings > Settings, and the Menus and Interface labels of each language, in the Studio. The options for each page, at the end of this page, stay in code in every edition.
Customizing The Navigation Button
To show or edit the button in the header, open src/config/config.toml and find this section:
[settings.navigationButton] enable = true # Show or hide the button label = "" # Button text. Leave empty to use the text in each language file url = "/contact/" # Button linkThe label is in each language file, so it can change with the language:
- Open
src/i18n/en.json, then the same file for each of your other languages, such assrc/i18n/fr.jsonandsrc/i18n/ar.json. - Find the
navigationgroup. - Change the
buttonLabelvalue.
"navigation": { "buttonLabel": "Get Started"}A value in label in config.toml replaces the text in every language.
Customizing The Side Panel
The round button opens a panel from the side, with your logo, a description, your address, phone, and email, your social links, and a button. On small screens, the panel also holds the menu.
[settings.headerOffcanvas] enable = true logo = "/images/logo-light.svg" description = "" # Leave empty to use the text in each language file
[settings.headerOffcanvas.button] enable = true label = "" # Leave empty to use the text in each language file url = "/contact/"The description and button label are in each language file, under headerOffcanvas: description and buttonLabel. The address, phone, and email come from your contact information.
Sticky Header
stickyHeader under [settings] turns on the scroll behavior of the header, such as hiding it as you scroll down.
[settings] stickyHeader = trueOptions For Each Page
Each page file in src/pages/[...lang]/ can set these options on Base:
| Option | Values | What it does |
|---|---|---|
headerPosition | sticky (the default), fixed, static | Where the header sits |
hasHeaderDarkBackground | true or false (the default) | Uses logoAlternate and light colors, for a dark page top |
hideOffcanvas | true or false (the default) | Hides the side panel and its button on large screens |
This is how the pages use them:
| Page | headerPosition | hasHeaderDarkBackground | hideOffcanvas |
|---|---|---|---|
/creative-agency/ | fixed | true | true |
/personal-portfolio/ | fixed | true | No |
/startup-agency/ | fixed | true | true |
/about/ | Default | No | true |
| Every other page | Default | No | No |
For example, in src/pages/[...lang]/startup-agency.astro:
<Base {...page?.data} hideOffcanvas={true} headerPosition="fixed" footerLayout={"footer-3"} hasHeaderDarkBackground={true}>Do It With AI
On the page [ROUTE FILE] in src/pages/[...lang]/, make the header [fixed / sticky] with a[dark / light] background, using headerPosition and hasHeaderDarkBackground on Base. Don't changeany other page. Keep settings.headerOffcanvas enabled, because the mobile menu is inside it. Thenrun npm run astro-check.