From 40c1f35ad2e248c77280c71d8ef98ffb1752b4ac Mon Sep 17 00:00:00 2001 From: micheleRP Date: Tue, 7 Jul 2026 15:57:06 -0600 Subject: [PATCH 1/8] feat: add is-preview-feature helper for page-preview attribute --- src/helpers/is-preview-feature.js | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 src/helpers/is-preview-feature.js diff --git a/src/helpers/is-preview-feature.js b/src/helpers/is-preview-feature.js new file mode 100644 index 00000000..f94603c8 --- /dev/null +++ b/src/helpers/is-preview-feature.js @@ -0,0 +1,26 @@ +'use strict' + +// Cache: Map> +let urlCache = null +let cachedComponent = null + +module.exports = (navUrl, { data: { root } }) => { + const { contentCatalog, page } = root + if (page.layout === '404') return false + if (!contentCatalog) return false + + // Build URL map once per component (O(n) once, then O(1) lookups) + if (cachedComponent !== page.component.name) { + urlCache = new Map() + cachedComponent = page.component.name + + const pages = contentCatalog.findBy({ component: page.component.name, family: 'page' }) + for (const p of pages) { + if (p.pub?.url) { + urlCache.set(p.pub.url, !!p.asciidoc?.attributes?.['page-preview']) + } + } + } + + return urlCache.get(navUrl) || false +} From 4bd16a091561ccef173f65cf73bfc72d4b8c4347 Mon Sep 17 00:00:00 2001 From: micheleRP Date: Tue, 7 Jul 2026 15:59:01 -0600 Subject: [PATCH 2/8] feat: render (Preview) pill on nav links for page-preview pages --- src/css/nav.css | 7 +++++++ src/partials/nav-tree.hbs | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/css/nav.css b/src/css/nav.css index 6265ced0..6a362920 100644 --- a/src/css/nav.css +++ b/src/css/nav.css @@ -673,6 +673,13 @@ html[data-theme="light"] .nav-item-toggle { white-space: nowrap; } +.nav-link.cloud-preview::after { + display: inline; + content: '(Preview)'; + margin-left: 4px; + white-space: nowrap; +} + .nav-link.cloud-limited-availability::after { display: inline; content: '(Limited)'; diff --git a/src/partials/nav-tree.hbs b/src/partials/nav-tree.hbs index 985574be..514cdfae 100644 --- a/src/partials/nav-tree.hbs +++ b/src/partials/nav-tree.hbs @@ -5,7 +5,7 @@ {{#if ./content}}
{{#if ./url}} - {{{./content}}} {{else}} From e46df0ff513d913f1aea9882e473eb4f2e880e47 Mon Sep 17 00:00:00 2001 From: micheleRP Date: Tue, 7 Jul 2026 16:02:02 -0600 Subject: [PATCH 3/8] feat: add Preview status badge with tooltip to sticky page header --- src/partials/article.hbs | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/src/partials/article.hbs b/src/partials/article.hbs index 0a19d237..8f22a0aa 100644 --- a/src/partials/article.hbs +++ b/src/partials/article.hbs @@ -28,6 +28,9 @@ {{#if page.attributes.beta}} beta {{/if}} + {{#if page.attributes.preview}} + Preview + {{/if}} {{#if page.attributes.limited-availability}} @@ -113,7 +116,7 @@ {{!-- Metadata now shown in sticky bar above --}}
{{/unless}} -{{#if (or page.attributes.beta page.attributes.limited-availability page.attributes.byoc page.attributes.cloud-only page.attributes.context-switcher)}} +{{#if (or page.attributes.beta page.attributes.preview page.attributes.limited-availability page.attributes.byoc page.attributes.cloud-only page.attributes.context-switcher)}}