Skip to main content
OwnDocs

Announcement Bar

1 min readStableIntermediate

A site-wide dismissible announcement bar can be activated by setting environment variables. The bar renders only when both the ID and message are set, and dismissals persist per announcement ID via localStorage.

Quick Start

Enable the bar with an ID and message.

Bash
Bash
NEXT_PUBLIC_ANNOUNCEMENT_ID=launch
NEXT_PUBLIC_ANNOUNCEMENT_MESSAGE="Welcome to our new docs"

Adding Options

Add a link. The link renders only when both the href and label are set.

Bash
Bash
NEXT_PUBLIC_ANNOUNCEMENT_ID=launch
NEXT_PUBLIC_ANNOUNCEMENT_MESSAGE="Welcome to our new docs"
NEXT_PUBLIC_ANNOUNCEMENT_HREF=/getting-started/introduction
NEXT_PUBLIC_ANNOUNCEMENT_LINK_LABEL="Get started"

Advanced

Set NEXT_PUBLIC_ANNOUNCEMENT_DISMISSIBLE=false to hide the close button. Changing the ID re-shows the bar to every reader because dismissal is keyed to the ID.

Options

NEXT_PUBLIC_ANNOUNCEMENT_IDenv

Dismissal key. Required with the message to render the bar.

NEXT_PUBLIC_ANNOUNCEMENT_MESSAGEenv

Banner message. Required with the ID to render the bar.

NEXT_PUBLIC_ANNOUNCEMENT_HREFenv

Optional link target. Internal paths and external URLs are accepted.

NEXT_PUBLIC_ANNOUNCEMENT_LINK_LABELenv

Optional link text. The link renders only when both the href and label are set.

NEXT_PUBLIC_ANNOUNCEMENT_DISMISSIBLEenvDefault: true

Set to false to hide the close button.

Was this page helpful?