Configuration
Ce contenu n’est pas encore disponible dans votre langue.
The starlight-announcement plugin accepts the following configuration options.
Basic Configuration
Section titled “Basic Configuration”import starlight from '@astrojs/starlight'import { defineConfig } from 'astro/config'import starlightAnnouncement from 'starlight-announcement'
export default defineConfig({ integrations: [ starlight({ plugins: [ starlightAnnouncement({ displayMode: 'stack', rotateInterval: 5000, announcements: [ // Your announcements here ], }), ], title: 'My Docs', }), ],})Plugin Options
Section titled “Plugin Options”enabled
Section titled “enabled”- Type:
boolean - Default:
true
Controls whether announcements are displayed. Set to false to disable all announcements while keeping your configuration intact.
starlightAnnouncement({ enabled: false, // Disable announcements announcements: [ // Config preserved but not shown ],})displayMode
Section titled “displayMode”- Type:
'stack' | 'first' | 'rotate' - Default:
'stack'
Controls how multiple active announcements are displayed. See Display Modes for details.
| Mode | Behavior |
|---|---|
stack | All active announcements shown vertically (default) |
first | Only the first matching announcement is displayed |
rotate | Carousel - cycles through announcements on interval |
starlightAnnouncement({ displayMode: 'first', // Only show one announcement at a time})rotateInterval
Section titled “rotateInterval”- Type:
number - Default:
5000 - Minimum:
500
Interval in milliseconds between announcement transitions when using rotate display mode.
starlightAnnouncement({ displayMode: 'rotate', rotateInterval: 3000, // 3 seconds between transitions})showRotateIndicator
Section titled “showRotateIndicator”- Type:
boolean - Default:
true
When using rotate display mode with multiple announcements, shows dot indicators below the banner. Users can click dots to jump to specific announcements, and the indicator supports keyboard navigation with arrow keys.
starlightAnnouncement({ displayMode: 'rotate', showRotateIndicator: true, // Show navigation dots (default) // showRotateIndicator: false, // Hide navigation dots})announcements
Section titled “announcements”- Type:
Announcement[] - Default:
[]
Array of announcement objects. Each announcement has the following properties:
| Property | Type | Required | Default | Description |
|---|---|---|---|---|
id | string | Yes | - | Unique identifier (used for dismissal persistence) |
content | string | Record<string, string> | Yes | - | The announcement text (supports HTML and localization) |
variant | string | No | 'note' | Visual style: note, tip, caution, danger |
dismissible | boolean | No | true | Whether users can dismiss the announcement |
link | object | No | - | Optional CTA link with text (localizable) and href |
startDate | string | No | - | ISO date when announcement becomes visible |
endDate | string | No | - | ISO date when announcement stops being visible |
showOn | string[] | No | ['/**'] | Glob patterns for pages to show on |
hideOn | string[] | No | [] | Glob patterns for pages to hide from |
See Announcement Options for detailed documentation of each property.
Complete Example
Section titled “Complete Example”import starlight from '@astrojs/starlight'import { defineConfig } from 'astro/config'import starlightAnnouncement from 'starlight-announcement'
export default defineConfig({ integrations: [ starlight({ plugins: [ starlightAnnouncement({ displayMode: 'stack', announcements: [ { id: 'v3-migration', content: 'v3.0 has breaking changes!', variant: 'caution', link: { text: 'Migration Guide', href: '/guides/v3-migration', }, dismissible: true, startDate: '2026-01-01', endDate: '2026-02-01', showOn: ['/**'], hideOn: ['/api/**'], }, { id: 'welcome', content: 'Welcome to our new documentation site!', variant: 'tip', showOn: ['/'], }, ], }), ], title: 'My Docs', }), ],})Next Steps
Section titled “Next Steps”- Announcement Options: Detailed guide on variants, scheduling, and targeting
- Display Modes: How to control multiple announcement display
- Internationalization: Localized content for multilingual sites
- Custom Styling: Customize appearance with CSS