Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DOC-1069 Adds the ability to set announcements on the pages too #249

Merged
merged 7 commits into from
Feb 27, 2025

Conversation

Deflaimun
Copy link
Contributor

@Deflaimun Deflaimun commented Jan 30, 2025

Adds the support to make announcements for specific pages/products/site.

Usage

To add a page-specific announcement add these keys in your page:

:page-announcement: true
:page-announcement-text: Page-specific announcement
:page-announcement-link: 'Learn more.'
:page-announcement-link-text: 'http://mylink.here.com'

To add a product-wide announcement, add those keys in the corresponding antora.yaml file:

asciidoc:
  attributes:
    keys:
      announcement: true
      announcement-text: 'product-wide test'
      announcement-link-text: 'Learn more.'
      announcement-link: 'http://mylink.here.com'

To add a site-wide announcement, continue adding the keys in the corresponding site yaml (playbook). Example with local-antora-playbook.yaml:

site:
  keys:
    announcement: true
    announcement-text: 'Site-wide announcement.'
    announcement-link-text: 'Learn more.'
    announcement-link: 'http://mylink.here.com'

The implementation respects the following order:
page > product > site

PS.
The file announcement-bar was auto-idented, that's why the changes look bigger than they are.

Copy link

netlify bot commented Jan 30, 2025

Deploy Preview for docs-ui ready!

Name Link
🔨 Latest commit 2585f05
🔍 Latest deploy log https://app.netlify.com/sites/docs-ui/deploys/67c054009c8698000852714d
😎 Deploy Preview https://deploy-preview-249--docs-ui.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@Deflaimun Deflaimun requested a review from JakeSCahill January 31, 2025 00:26
@Deflaimun
Copy link
Contributor Author

Latest change enables page > product > site announcements

@@ -12,7 +12,8 @@
const banner = document.getElementById(bannerId);
if (!banner) return;

const hasSeenBanner = window.sessionStorage.getItem(sessionKey) || false;
const storageKey = sessionKey;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We might need unique keys for different announcement types. For example, if both site-wide and page-wide is enabled, and I close site-wide, page-wide should stay open

@JakeSCahill JakeSCahill changed the title Adds the ability to set announcements on the pages too DOC-1069 Adds the ability to set announcements on the pages too Feb 27, 2025
@JakeSCahill JakeSCahill merged commit c4ba804 into main Feb 27, 2025
6 checks passed
@JakeSCahill JakeSCahill deleted the DOC-991-allow-announcements-pages branch February 27, 2025 12:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants