On this page
The header
The header floats above the page: the logo, the menu (Features, Pricing, Docs, Customers and Blog), the search icon, the theme toggle, your GitHub icon and the “Start free” button, which leads to the pricing page. The search icon opens the search page (/search/). At the top of the page the header has no background at all. As soon as the page scrolls, its capsule comes in: dark over the hero, in both modes, and in light mode light once the hero has scrolled away under it. The script in src/components/site/SiteHeader.astro only changes its classes; the browser moves it.
From 1024px wide the header shows the menu; narrower screens get a menu button. On a phone the menu opens as a panel (src/components/site/MobileMenu.astro): a search field, Home, the menu’s items, About and Contact, each with an icon, and the header’s button. Name, links and menu says where the menu is set.
The announcement bar
The bar sits above the header, on a gradient in the site’s colour, with one or two announcements. Each is a link with an optional label such as “New”, a title and a line. Visitors can close it, unless closable is false.
It’s set in announcement in src/config/theme.config.mjs:
announcement: {
show: true,
mobile: true,
closable: false,
id: 'flightdeck-demo',
items: [
{ href: 'https://github.com/hansmartensdev/Astro-Flightdeck', key: 'announcement.first' },
{ href: '/docs/', key: 'announcement.docs', icon: 'book-open' },
],
},
| Field | What it does |
|---|---|
show |
false removes the bar. The demo’s bar announces the made-up product’s news and links to these docs: turn it off or change it on your own site. |
mobile |
false hides it on a phone, below 640px. |
closable |
false leaves out the close button: the bar always shows, and nothing is kept in the browser. Leave it out, or true, for the button. |
id |
A closed bar stays closed for this id. Give a new announcement a new id, so visitors who closed the last one see it. |
items |
One or two announcements: the link, and the key of its words in the translations (tag, title and text). icon, a Lucide name, replaces the label. |
Check that no announcement links to a page that’s turned off, such as /docs/ with docs: false.
Below 900px wide only the first announcement shows, with its label and title.
How they move together
The bar and the header are one sticky block. The bar scrolls away with the page, and the block sticks once the header reaches the top.