|
@@ -18,11 +18,14 @@ module.exports.register = function ({ config: { templatePath = './docsearch/conf
|
|
|
const templateSrc = await fsp.readFile(templatePath, 'utf8')
|
|
|
const templateBasename = ospath.basename(templatePath)
|
|
|
const template = handlebars.compile(templateSrc, { noEscape: true, preventIndent: true, srcName: templateBasename })
|
|
|
- const components = contentCatalog.getComponentsSortedBy('name').filter((component) => component.latest.version)
|
|
|
+ const latestVersions = contentCatalog.getComponentsSortedBy('name').reduce((accum, component) => {
|
|
|
+ component.versions.forEach((version) => version.versionSegment !== undefined && accum.push(version))
|
|
|
+ return accum
|
|
|
+ }, [])
|
|
|
const stopPages = contentCatalog.getPages((page) => {
|
|
|
return page.out && ('page-archived' in page.asciidoc.attributes || 'page-noindex' in page.asciidoc.attributes)
|
|
|
})
|
|
|
- const compiled = template({ components, site: playbook.site, stopPages })
|
|
|
+ const compiled = template({ latestVersions, site: playbook.site, stopPages })
|
|
|
siteCatalog.addFile({ contents: Buffer.from(compiled), out: { path: 'docsearch-config.json' } })
|
|
|
})
|
|
|
}
|