Skip to content
Welcome to starlight-announcement plugin! Get Started

Plugin vs Built-in Banner

Starlight includes a built-in Banner component for displaying page-level announcements. This guide explains when to use the built-in Banner versus the starlight-announcement plugin.

FeatureBuilt-in Bannerstarlight-announcement
ConfigurationPer-page frontmatterSite-wide astro.config.mjs
DismissibleNoYes (with localStorage persistence)
Visual variantsSingle style4 variants (note, tip, caution, danger)
SchedulingNoYes (startDate/endDate)
Page targetingManual (per-page)Automatic (glob patterns)
Multiple bannersNoYes (stack, first, rotate modes)
CTA linksManual HTMLBuilt-in link option
InternationalizationNo (static string)Yes (locale-keyed objects)

Starlight’s built-in Banner is configured per-page using frontmatter:

---
title: My Page
banner:
content: |
This page has been updated!
<a href="/changelog">See what's new</a>
---

The built-in Banner works well for page-specific notices that only apply to a single page, simple static announcements where you don’t need dismissal or visual variants, and situations where you want minimal setup without installing a plugin.

  • Must be added to each page individually
  • No way for users to dismiss the banner
  • Single visual style (accent color background)
  • No date-based scheduling
  • No automatic page targeting
  • No internationalization support (same content for all locales)

This plugin is configured once in astro.config.mjs and applies site-wide:

starlightAnnouncement({
announcements: [
{
id: 'v2-release',
content: 'Version 2.0 is now available!',
variant: 'tip',
link: { text: 'See changelog', href: '/changelog' },
dismissible: true,
startDate: '2026-01-01',
endDate: '2026-01-31',
showOn: ['/**'],
hideOn: ['/api/**'],
},
],
})

This plugin shines when you need announcements that span multiple pages, especially if users should be able to dismiss them. It’s also the right choice for time-sensitive content like sales or maintenance windows, when you want to show multiple announcements at once, or when you need visual variants to convey urgency.

Configure your announcements once in astro.config.mjs and they apply everywhere. No need to edit individual pages. Users can dismiss announcements, and their preference is remembered via localStorage. Scheduling lets you set start and end dates for time-limited content. The four visual variants (note, tip, caution, danger) convey meaning through color, and glob patterns let you target specific sections without touching frontmatter. For multilingual sites, content and link text can be localized using locale-keyed objects.

The plugin is designed to work alongside the built-in Banner. When both are present:

  1. The built-in Banner renders first (from page frontmatter)
  2. Plugin announcements render below it

This allows you to use:

  • Built-in Banner for page-specific notices
  • Plugin announcements for site-wide messaging
---
title: API Reference
banner:
content: This API is in beta. Expect breaking changes.
---

Combined with plugin config:

starlightAnnouncement({
announcements: [
{
id: 'conference',
content: 'Join us at DevCon 2026!',
variant: 'tip',
showOn: ['/**'],
},
],
})

Result: The page shows both the page-specific beta warning AND the site-wide conference announcement.

If you have existing Banner content in frontmatter that you want to centralize:

guides/intro.mdx
---
banner:
content: New tutorial available!
---
// guides/advanced.mdx
---
banner:
content: New tutorial available!
---
starlightAnnouncement({
announcements: [
{
id: 'new-tutorial',
content: 'New tutorial available!',
variant: 'tip',
showOn: ['/guides/**'],
},
],
})

Then remove the banner frontmatter from individual pages.