This guide provides detailed instructions for adding, enabling, and disabling announcement banners on the GeoDa Docusaurus site.
The announcement system uses a banner component that appears at the top of the homepage. It's designed to highlight important news, updates, or events. The banner is dismissible by users and uses a date-based system to ensure new announcements are displayed even after users have dismissed previous ones.
-
Open the announcements configuration file:
# Navigate to the data directory cd src/data
-
Edit
announcements.jsonand update the current announcement:{ "current": { "text": "🚀 GeoDa 1.22.0.20 (7/31/2025) is now available! 🎯", "url": "/download", "date": "07/31/2025", "active": true } } -
Customize the announcement:
- Update the
textprop with your message - Update the
urlprop with the target link - Set a unique
date(MM/DD/YYYY format) - Set
activetotrueto enable the announcement
- Update the
-
Test locally:
pnpm start
-
Commit and deploy:
git add src/data/announcements.json git commit -m "Add new announcement: [Your Message]" git push origin main
The announcement system consists of:
AnnouncementBanner.tsx: The main component (located insrc/components/)AnnouncementBanner.module.css: Styling for the bannerannouncements.json: Configuration file for managing announcements- Usage in
index.tsx: Where the banner is displayed
The announcement system uses dates to ensure users see new announcements:
- When a user dismisses an announcement: The date is stored in localStorage
- When a new announcement is published: The system compares the new date with the last dismissed date
- If the new announcement is newer: It will be displayed to the user
- If the new announcement is older: It will be hidden (user has already seen it)
This means users will always see new announcements, even if they've dismissed previous ones.
-
Edit
src/data/announcements.json:{ "current": { "text": "🎉 GeoDa 2.0 is now available! Download the latest version.", "url": "/download", "date": "08/15/2025", "active": true }, "previous": [ { "text": "🚀 GeoDa 1.22.0.20 (7/31/2025) is now available! 🎯", "url": "/download", "date": "07/31/2025", "active": false } ] } -
Move the current announcement to previous:
- Copy the current announcement to the
previousarray - Set
active: falsefor the previous announcement - Update the
currentobject with your new announcement
- Copy the current announcement to the
To temporarily disable an announcement without removing it:
{
"current": {
"text": "Your announcement text",
"url": "/your-link",
"date": "08/15/2025",
"active": false
}
}To completely remove an announcement, simply update the current object with a new announcement or set active: false.
- Use MM/DD/YYYY format:
MM/DD/YYYY - Example:
07/31/2025
- Use release dates: For version releases, use the actual release date
- Use event dates: For events, use the event start date
- Use current date: For general announcements, use the current date
- Be consistent: Always use the same format (MM/DD/YYYY) for consistency
// Version release
{
"text": "🚀 GeoDa 2.1.0 Released! New spatial analysis tools available.",
"url": "/download",
"date": "08/15/2025",
"active": true
}
// Conference announcement
{
"text": "🎯 Join us at Spatial Data Science Conference 2024!",
"url": "/events/conference-2024",
"date": "09/01/2024",
"active": true
}
// Workshop announcement
{
"text": "📚 Free Workshop: Introduction to Spatial Data Science",
"url": "/workshops/intro-spatial",
"date": "08/20/2024",
"active": true
}-
Start the development server:
pnpm start
-
Test the announcement:
- Visit the homepage to see the announcement
- Click the close button to dismiss it
- Refresh the page to verify it's hidden
- Update the date to a newer date and refresh to see it again
-
Test with different dates:
- Try setting the date to a date older than the last dismissed one
- Verify the announcement doesn't show
- Try setting the date to a newer date
- Verify the announcement shows again
- Check that
activeis set totrue - Verify the date is newer than the last dismissed date
- Clear localStorage to reset user preferences:
localStorage.removeItem('announcement-banner-last-dismissed')
- Check that the date is properly formatted (MM/DD/YYYY)
- Verify the component is receiving the correct props
- Check the browser console for any errors
The system maintains backward compatibility with the old localStorage key (announcement-banner-hidden) for announcements without dates.
- Keep announcements concise: 50-100 characters work best
- Use emojis: Add visual appeal (🎉, 🚀, ⚡, 🎯, etc.)
- Include call-to-action: "Download now", "Learn more", "Register today"
- Be specific: Mention version numbers, dates, or specific features
- Use meaningful dates: Use actual release dates or event dates
- Test thoroughly: Always test with different dates before deploying
{
"current": {
"text": "🚀 GeoDa 1.22.0.20 (7/31/2025) is now available! 🎯",
"url": "/download",
"date": "07/31/2025",
"active": true
}
}{
"current": {
"text": "🎯 Join us at Spatial Data Science Conference 2024!",
"url": "/events/conference-2024",
"date": "09/01/2024",
"active": true
}
}{
"current": {
"text": "📚 Free Workshop: Introduction to Spatial Data Science",
"url": "/workshops/intro-spatial",
"date": "08/20/2024",
"active": true
}
}{
"current": {
"text": "⚠️ Scheduled maintenance on Sunday, 2-4 PM EST",
"url": "/status",
"date": "08/18/2024",
"active": true
}
}