1
0
mirror of synced 2026-08-06 02:08:01 +00:00

only index pages from the latest version in each release line

This commit is contained in:
Dan Allen
2023-01-11 03:04:03 -07:00
committed by Rob Winch
parent 33b1038eb6
commit ac8e3f6810
2 changed files with 9 additions and 8 deletions
@@ -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' } })
})
}