#site-wide banner?

4 messages · Page 1 of 1 (latest)

bleak charm
#

How can I add a site-wide banner that I dont need to redefine on every page? Like an annoucement banner?

thick cradleBOT
#

Hi @bleak charm. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:

#

Astro itself doesn’t have a built‑in “site‑wide banner” feature, but Starlight (the Astro-powered docs theme) does have a banner frontmatter field that shows an announcement banner per page. [banner frontmatter]

By default, that banner is per page, not global. The official docs only mention:

---
title: Page with a banner
banner:
  content: |
    We just launched something cool!
    <a href="<https://example.com">Check> it out</a>
---

which displays a banner on that page only. [banner frontmatter]

There is a community recipe specifically titled “Add a sitewide banner to Starlight”, which explains how to turn this per‑page banner feature into a site‑wide one, but the detailed steps are not included in the knowledge I have—only the link is referenced. [Community content]

So, based on the available sources:

  • Starlight supports per‑page banners via banner frontmatter.
  • A site‑wide banner is possible using that mechanism, but the exact implementation details are only referenced in an external community guide that I can’t quote from here.

To implement a true site‑wide banner in Starlight, you’ll need to follow that external guide: “Add a sitewide banner to Starlight” linked from the Starlight community content page. [Community content]

#

If you’re not using Starlight, the knowledge sources don’t describe a generic Astro pattern for a global banner (e.g. via a shared layout), so I can’t provide a concrete, documented snippet for that.

Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: