Announcements
Pro Feature — The announcement system is available in the Pro and Agency tiers.
Unfold CMS includes a site-wide announcement system for displaying banners, notifications, and alerts to your visitors. Announcements appear at the top of your site and can be targeted to specific audiences.
Overview
Announcements provide:
- Site-wide banners — Prominent messages displayed across all pages
- Audience targeting — Show to all visitors, authenticated users only, or guests only
- Date scheduling — Set start and end dates for time-limited messages
- Priority ordering — Control which announcement appears first when multiple are active
- Toggle visibility — Quickly enable or disable announcements
Creating Announcements
Navigate to Marketing > Announcements in the admin panel.
Announcement Fields
| Field | Description |
|---|---|
| Title | Internal title for identification |
| Content | The message displayed to visitors (supports HTML) |
| Type | Visual style (info, success, warning, danger) |
| Audience | Who sees it: All, Authenticated, or Guests |
| Active | Whether the announcement is currently shown |
| Start Date | When to start showing (optional) |
| End Date | When to stop showing (optional) |
| Priority | Display order (higher priority shown first) |
Announcement Types
| Type | Color | Use Case |
|---|---|---|
| Info | Blue | General information, updates |
| Success | Green | Positive news, promotions |
| Warning | Amber | Important notices, maintenance |
| Danger | Red | Critical alerts, outages |
Audience Targeting
| Target | Shown To |
|---|---|
| All | Every visitor |
| Authenticated | Logged-in users only |
| Guests | Non-logged-in visitors only |
This lets you show different messages to different audiences. For example:
- Guests — "Sign up today and get 20% off!"
- Authenticated — "Your subscription renews in 3 days"
- All — "We'll be performing maintenance on Saturday"
Active Scope
An announcement is considered active when:
- The
activestatus is enabled - The current date is after the start date (if set)
- The current date is before the end date (if set)
The system filters announcements using the active scope, which checks all three conditions.
Displaying Announcements
The template includes announcements automatically. The getForDisplay method retrieves the appropriate announcement for the current context (checks audience and authentication status).
In templates, announcements are typically rendered in the layout above the header:
@php
$announcement = \App\Models\Announcement::getForDisplay();
@endphp
@if($announcement)
<div class="announcement announcement-{{ $announcement->type }}">
{!! $announcement->content !!}
</div>
@endif
Caching
Announcement queries are cached for performance. The cache is automatically cleared when:
- An announcement is created, updated, or deleted
- An announcement's active status is toggled
Related
- Code Snippets — Custom code injection for banners and scripts
- Maintenance Mode — Full site maintenance messaging