Skip to content

Commit 977a83a

Browse files
authored
Avoid tagging with utility component titles (#128)
1 parent d327321 commit 977a83a

File tree

3 files changed

+16
-5
lines changed

3 files changed

+16
-5
lines changed

extensions/algolia-indexer/generate-index.js

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -178,19 +178,30 @@ function generateIndex (playbook, contentCatalog, { indexLatestOnly = false, exc
178178
let tag;
179179
const title = (component.title || '').trim();
180180
if (title.toLowerCase() === 'home') {
181-
// Collect all unique component titles except 'home' using public API when available
181+
// Collect all unique component titles except 'home', 'shared', 'search' using public API when available
182182
const componentsList = typeof contentCatalog.getComponents === 'function'
183183
? contentCatalog.getComponents()
184184
: Array.isArray(contentCatalog.components)
185185
? contentCatalog.components
186186
: Object.values(contentCatalog.components || contentCatalog._components || {});
187+
// Find the latest version for Self-Managed (component title: 'Self-Managed')
188+
let latestVersion = undefined;
189+
const selfManaged = componentsList.find(c => (c.title || '').trim().toLowerCase() === 'self-managed');
190+
if (selfManaged && selfManaged.latest && selfManaged.latest.version) {
191+
latestVersion = selfManaged.latest.version;
192+
if (latestVersion && !/^v/.test(latestVersion)) latestVersion = 'v' + latestVersion;
193+
}
187194
const allComponentTitles = componentsList
188195
.map(c => (c.title || '').trim())
189-
.filter(t => t && t.toLowerCase() !== 'home');
196+
.filter(t => t && !['home', 'shared', 'search'].includes(t.toLowerCase()));
190197
if (!allComponentTitles.length) {
191198
throw new Error('No component titles found for "home" page. Indexing aborted.');
192199
}
193200
tag = [...new Set(allComponentTitles)];
201+
// For Self-Managed, append v<latest-version> to the tag
202+
if (latestVersion) {
203+
tag = tag.map(t => t.toLowerCase() === 'self-managed' ? `${t} ${latestVersion}` : t);
204+
}
194205
} else {
195206
tag = `${title}${version ? ' v' + version : ''}`;
196207
}

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@redpanda-data/docs-extensions-and-macros",
3-
"version": "4.7.3",
3+
"version": "4.7.4",
44
"description": "Antora extensions and macros developed for Redpanda documentation.",
55
"keywords": [
66
"antora",

0 commit comments

Comments
 (0)