Skip to main content
Drupal is a registered trademark of Dries Buytaert
Release: OpenID Connect / OAuth client 3.0.0-alpha9 New alpha version released for module openid_connect (3.0.0-alpha9). Release: Opensolr Search 4.5.0 Minor update available for module opensolr_search (4.5.0). Release: Timelinr 1.0.1 Minor update available for module timelinr (1.0.1). Usage Milestone: Simplify Module simplify crossed 10,000 active installs. Usage Milestone: Views Reference Filter Module entityreference_filter crossed 10,000 active installs. Usage Milestone: Dropdown Language Module dropdown_language crossed 10,000 active installs. Usage Milestone: Paragraphs Browser Module paragraphs_browser crossed 10,000 active installs. Usage Milestone: OpenAPI Module openapi crossed 10,000 active installs. Usage Milestone: Decoupled Router Module decoupled_router crossed 10,000 active installs. Module Revived: Entityqueue Buttons 1.1.2 Module entityqueue_buttons updated after 8 months of inactivity (1.1.2).

Sitewide Alert

7,430 sites Security covered Drupal 10–11
View on drupal.org

The Sitewide Alert module allows you to display important messages at the top of your website. You can use it to inform visitors about maintenance, updates, sales, or any other timely information. The module offers customizable styles, scheduling, and visitor dismissal options.

The Sitewide Alert module adds the ability to show alerts at the top of your site.

This module can be used for showing alerts to your visitors to inform them of planned maintenance periods, emergency/weather information, shipping delays, flash sales, and more. How you use it is up to you.

Features

  • Cache-friendly by design. Adding or updating alerts does not invalidate the full page cache for all pages on the site.
    • (Experimental) Server-side rendering available to reduce layout shift. See the README for caching considerations.
  • Renders at the top of every page, no block configuration needed.
    • Optional sub-module for block placement.
  • Multiple alerts with configurable styles (e.g., red for urgent, white for subtle).
  • Visitor-dismissible, with editor option to reset dismissals.
  • Page visibility controls and scheduled start/end times.
  • Live updates -- new alerts appear without a page reload.
  • Fieldable, themeable, and works with Domain.

Getting started

Installation

Install the Sitewide Alert module with Composer.

$ composer require 'drupal/sitewide_alert:^3.1'

Configuration

Once installed, Sitewide Alert is ready to use. However, some customization is likely necessary.

Upon installation, there is only one Alert Style (Default). This can be extended by navigating to /admin/config/sitewide_alerts and defining new Alert Style types. Define each key|value pair on its own line.

To show Sitewide Alerts on administrative pages, navigate to /admin/config/sitewide_alerts and select the "Show on Administrative Pages" checkbox.

Creating a Sitewide Alert

Navigate to /admin/content/sitewide_alert and click the "Add New Sitewide Alert" button and complete the following fields:

  • Name
    • Give your alert an administrative name.
  • Alert Style
    • Select a style for your alert.
  • Alert Message
    • Compose your alert message. Full WYSIWYG support available.
  • Dismissible
    • Select this checkbox if the alert should be dismissable by visitors.
  • Schedule Alert
    • Select this checkbox if the alert should only appear during a specific time period.
  • PAGE VISIBILITY - Limit by Page
    • Select this checkbox if alert should only appear on specific pages. Use the "Pages" input field to specify pages by using their paths.
  • Any additional fields
    • Additional fields can be added to alerts by site builders with sufficient permissions.

Theming/Styling Sidewide Alerts

Using CSS classes

Sitewide Alerts receive a wrapping class that can be used to apply specific styles. For each entry added to the Alert Style field, a corresponding HTML class is added to the element's wrapper. The class is created by concatenating "alert-" with each key defined under Alert Style. Use these classes to apply different styles to each type of alert needed.

Using twig templates

Alerts can themed by overriding the sitewide-alert.html.twig twig templates. Template suggestions also exist for each
of the Alert Style types and if the alert is or is not dismissible.

Template suggestions

  • sitewide-alert.html.twig
  • sitewide-alert--STYLETYPE.html.twig
  • sitewide-alert--dismissible.html.twig
  • sitewide-alert--notdismissible.html.twig
  • sitewide-alert--STYLETYPE--dismissible.html.twig
  • sitewide-alert--STYLETYPE--notdismissible.html.twig

Troubleshooting

Scheduled alerts not showing/disappearing when they should.

  • Make sure the scheduled sitewide alert is marked as "Active". Scheduled alerts still need to be set as active to be shown.
  • If using the Redis caching module, you may need to apply this patch to allow Drupal's Page Cache to actually expire when it should.

Similar modules

Depends on

Dependencies of the latest stable release

  • datetime_range Drupal core
  • options Drupal core
  • text Drupal core

Required by

Tracked projects that depend on this one

No tracked projects depend on this one yet.

Activity

Tracked releases
10
Tracked since
Nov 2024
Latest release
3 months ago
Releases (12 mo)
6 ▲ from 4
Maintenance
Active

Release Timeline

Releases

Version Type Core Release date
3.1.2 Stable 10–11 May 13, 2026
3.1.1 Stable 10–11 Mar 27, 2026
3.1.0 Stable 10–11 Mar 12, 2026
3.1.0-beta3 Pre-release 10–11 Feb 14, 2026
3.1.0-beta2 Pre-release 10–11 Nov 26, 2025
3.1.x-dev Dev 10–11 Nov 26, 2025
3.0.1 Stable 10–11 Jul 10, 2025
3.0.0 Stable 10–11 Dec 28, 2024
3.0.0-alpha1 Pre-release 10–11 Nov 5, 2024
3.0.x-dev Dev 10–11 Nov 4, 2024