Skip to content

Conversation

@paulohtb6
Copy link
Contributor

@paulohtb6 paulohtb6 commented Feb 6, 2026

This PR introduces a new limited availability badge to be used in pages.

Pages that have the attribute :page-limited-availability: true will have

  1. Main content area - A pill-shaped badge below the title
  2. TOC (right side) - When you scroll, a pill-shaped badge it appears in the navigation
  3. Left nav - An additional (Limited) will be shown next to the page title in the left navigation

Docs how to use it redpanda-data/docs-site#158

image image

Mobile
image

@netlify
Copy link

netlify bot commented Feb 6, 2026

Deploy Preview for docs-ui ready!

Name Link
🔨 Latest commit 5ef277f
🔍 Latest deploy log https://app.netlify.com/projects/docs-ui/deploys/69864c5172949300091abfc8
😎 Deploy Preview https://deploy-preview-365--docs-ui.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
Lighthouse
Lighthouse
1 paths audited
Performance: 35 (🟢 up 7 from production)
Accessibility: 93 (no change from production)
Best Practices: 100 (no change from production)
SEO: 89 (no change from production)
PWA: -
View the detailed breakdown and full score reports

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

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 6, 2026

Important

Review skipped

Auto incremental reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

  • 🔍 Trigger a full review
📝 Walkthrough

Walkthrough

This pull request introduces a "Limited Availability" badge feature across the documentation UI, mirroring the existing beta badge pattern. It adds documentation for the feature in a new AsciiDoc page, updates configuration with new navigation items and page-level attributes, introduces CSS variables and styling for the badge appearance, creates helper functions to detect limited availability status and extract descriptions from content, and modifies Handlebars templates to conditionally render the badge in the article metadata, sticky table-of-contents, and navigation areas. A new social-meta partial consolidates Open Graph and Twitter Card metadata handling.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

  • PR #298: Both implement second page-status badges (limited-availability vs. beta) with analogous tooltip and CSS variable changes across templates and styling layers.
  • PR #304: Both modify badge styling and tooltip initialization at template and CSS levels, affecting article metadata presentation.
  • PR #317: Both update UI metadata badge templates and styles in article.hbs, toc.hbs, and related CSS files.

Suggested reviewers

  • kbatuigas
  • Feediver1
🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 inconclusive)
Check name Status Explanation Resolution
Description check ❓ Inconclusive No pull request description was provided by the author, making it impossible to assess relevance to the changeset. Add a pull request description explaining the purpose and scope of the limited availability badge feature.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title 'add limited availability badge' is clear, specific, and accurately describes the main change in the changeset.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch limited-availabilit

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 5

🤖 Fix all issues with AI agents
In `@src/helpers/extract-description.js`:
- Around line 11-14: The exported helper (module.exports) is receiving
Handlebars' options hash as the second argument so maxLength becomes an object;
update the helper to detect when the second argument is an options hash (check
for an object with a "hash" property), extract a numeric maxLength from
options.hash.maxLength (fall back to the default 160 if missing or not a
number), and coerce it to a Number before using it in the description.length >
maxLength comparison (also keep the existing guard for non-string content); this
preserves calling from templates like {{extract-description page.contents
maxLength=200}} and ensures truncation works.

In `@src/helpers/is-limited-availability-feature.js`:
- Around line 18-22: Loop currently assumes navGroup.pub and navGroup.asciidoc
exist and directly reads navGroup.pub.url and navGroup.asciidoc.attributes,
which can throw TypeError for unpublishable or unpopulated entries; update the
loop over navGroupCache to guard these properties (e.g., check navGroup.pub &&
navGroup.pub.url === navUrl and navGroup.asciidoc &&
navGroup.asciidoc.attributes &&
navGroup.asciidoc.attributes['page-limited-availability']) before accessing them
so only safe accesses return true.

In `@src/partials/article.hbs`:
- Around line 73-93: The limited-availability tooltip initialization omits the
Tippy.js option to append tooltips to body, which can cause clipping/stacking
issues; update the two tippy(...) calls that target topLimitedAvailabilityBadge
and navLimitedAvailabilityBadge to include appendTo: () => document.body
(matching the beta tooltip usage) so the popper elements are appended to
document.body rather than their parent containers.

In `@src/partials/social-meta.hbs`:
- Around line 15-20: The meta title tags use unescaped triple-stache expressions
({{{this}}} and {{{`@root.page.component.title`}}}) which can inject raw HTML and
break content="..." attributes; replace these with HTML-escaped double-stache
expressions ({{this}} and {{`@root.page.component.title`}}) or pass the values
through the existing detag/escape helper (e.g., detag or an escape helper)
before interpolation so titles are sanitized when rendered in the meta
property="og:title" and similar meta tag content attributes.
- Around line 40-48: The OG image currently points to an SVG
(redpanda-docs-logo.svg) which many social platforms don't render; update the
template in social-meta.hbs to reference a raster fallback (e.g.,
redpanda-docs-logo.png at 1200x630) in both branches that build the URL (the
{{`#if` site.url}} branch and the else branch) by replacing the SVG filename with
the PNG fallback (preserve use of {{site.url}} and {{uiRootPath}}), and ensure
the meta tags (og:image and any twitter:image equivalents) point to that PNG and
maintain the width/height/meta-alt entries already present.
🧹 Nitpick comments (6)
src/partials/nav-tree.hbs (1)

8-8: Both cloud-beta and cloud-limited-availability can apply simultaneously.

If a page has both page-beta (or equivalent) and page-limited-availability attributes, both ::after pseudo-elements would try to render. Since an element can only have one ::after, only the last rule in CSS specificity order would take effect. This is fine if mutual exclusivity is intended — but if a page could legitimately carry both flags, only the limited-availability badge would render (it comes later in the stylesheet). Worth confirming this is the desired behavior.

src/helpers/extract-description.js (2)

29-33: Line 32 regex is unreachable — newlines are already replaced on line 31.

/\s+/g on line 31 replaces all whitespace (including \n) with a single space. By the time line 32 executes, there are no newlines left, so /\n\s*\n/g can never match.

♻️ Swap the order or remove the dead regex
   cleanText = cleanText
-    .replace(/\s+/g, ' ') // Replace multiple spaces with single space
-    .replace(/\n\s*\n/g, ' ') // Remove line breaks
+    .replace(/\n\s*\n/g, ' ') // Collapse paragraph breaks first
+    .replace(/\s+/g, ' ')     // Then normalize all remaining whitespace
     .trim()

36-50: First-sentence extraction discards the period/punctuation.

cleanText.split(/[.!?]+/) drops the sentence-ending punctuation. The extracted description will read as an incomplete fragment (e.g., "This page tests the Limited Availability badge in the UI preview" without the trailing period). For a meta description this is cosmetically fine, but if you want grammatically complete sentences, capture the delimiter too.

src/helpers/is-limited-availability-feature.js (1)

3-4: Module-level caches persist across the process lifetime.

The navGroupCache and componentCache variables at lines 3–4 are module-level and persist for the entire Node.js process. In watch/serve mode, if pages are added or attributes change, the cache will serve stale data until a different component name is encountered. This matches the existing caching pattern in is-beta-feature.js, confirming this is an established approach in the codebase.

src/css/metadata.css (1)

232-283: Consider consolidating duplicated badge styles.

The limited-availability styles (lines 232–283) are nearly identical to the beta styles (lines 180–230), differing only in class names, CSS variable references, and min-width. You could reduce duplication by extracting shared properties into a common class (e.g., .badge-label, .nav-badge-container, .nav-badge-label) and layering only the differing values via modifier classes.

This is a low-priority cleanup and fine to defer.

src/partials/social-meta.hbs (1)

22-37: Description fallback logic is repeated three times (OG, Twitter, itemprop).

The same cascade (page.description → extract-description → ROOT/component fallback) is duplicated across OG (lines 23–37), Twitter (lines 62–76), and partially for itemprop (lines 89–93). Additionally, head-info.hbs has a fourth copy for the <meta name="description"> tag. Consider computing the description once and reusing it, e.g., via a Handlebars variable or a dedicated helper.

Also applies to: 61-76, 88-98

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.

1 participant