@redpanda-data/docs-extensions-and-macros 4.7.2 → 4.7.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -175,7 +175,36 @@ function generateIndex (playbook, contentCatalog, { indexLatestOnly = false, exc
175
175
  .replace(/\s+/g, ' ')
176
176
  .trim();
177
177
 
178
- var tag = `${component.title} ${version ? 'v' + version : ''}`.trim();
178
+ let tag;
179
+ const title = (component.title || '').trim();
180
+ if (title.toLowerCase() === 'home') {
181
+ // Collect all unique component titles except 'home', 'shared', 'search' using public API when available
182
+ const componentsList = typeof contentCatalog.getComponents === 'function'
183
+ ? contentCatalog.getComponents()
184
+ : Array.isArray(contentCatalog.components)
185
+ ? contentCatalog.components
186
+ : 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
+ }
194
+ const allComponentTitles = componentsList
195
+ .map(c => (c.title || '').trim())
196
+ .filter(t => t && !['home', 'shared', 'search'].includes(t.toLowerCase()));
197
+ if (!allComponentTitles.length) {
198
+ throw new Error('No component titles found for "home" page. Indexing aborted.');
199
+ }
200
+ 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
+ }
205
+ } else {
206
+ tag = `${title}${version ? ' v' + version : ''}`;
207
+ }
179
208
  var indexItem;
180
209
  const deployment = page.asciidoc?.attributes['env-kubernetes'] ? 'Kubernetes' : page.asciidoc?.attributes['env-linux'] ? 'Linux' : page.asciidoc?.attributes['env-docker'] ? 'Docker' : page.asciidoc?.attributes['page-cloud'] ? 'Redpanda Cloud' : ''
181
210
 
@@ -198,12 +227,12 @@ function generateIndex (playbook, contentCatalog, { indexLatestOnly = false, exc
198
227
  indexItem.product = component.title;
199
228
  indexItem.breadcrumbs = breadcrumbs;
200
229
  indexItem.type = 'Doc';
201
- indexItem._tags = [tag];
230
+ indexItem._tags = Array.isArray(tag) ? tag : [tag];
202
231
  } else {
203
232
  indexItem.deployment = deployment;
204
233
  indexItem.type = 'Lab';
205
234
  indexItem.interactive = false;
206
- indexItem._tags = [tag];
235
+ indexItem._tags = Array.isArray(tag) ? tag : [tag];
207
236
  }
208
237
  algolia[cname][version].push(indexItem)
209
238
  algoliaCount++
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@redpanda-data/docs-extensions-and-macros",
3
- "version": "4.7.2",
3
+ "version": "4.7.4",
4
4
  "description": "Antora extensions and macros developed for Redpanda documentation.",
5
5
  "keywords": [
6
6
  "antora",