Skip to content
Astro Rocket
Get in touch

Docs · Make it yours

The header and the bar

The floating header, the menu on a phone, and the announcement bar above them.

All docs pages

The header

The header floats above the page: the logo, the menu, the search icon, the theme toggle, your GitHub icon and the “Get in touch” button. The search icon opens the search page (/search/); on a phone, the menu has a search field too. At the top of the page it 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, the pages with an icon each, and the header’s button.

The announcement bar

The bar is a capsule above the floating header, in the header’s own dark glass, with the hero’s colour running behind both. It holds one or two announcements. Each is a link with an optional label such as “Demo”, a title and a line. Visitors can close it, unless closable is false.

It’s set in announcement in src/config/aurora.config.mjs:

announcement: {
  show: true,
  mobile: true,
  closable: false,
  id: 'rocket-demo',
  items: [
    { href: 'https://github.com/hansmartensdev/Astro-Rocket', key: 'announcement.first' },
    { href: '/docs/', key: 'announcement.docs', icon: 'book-open' },
  ],
},
Field What it does
show false removes the bar. The demo’s bar is about the theme: turn it off 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.

On a phone 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.