mirror of
https://github.com/spring-projects/spring-security.git
synced 2025-05-31 17:22:13 +00:00
only index pages from the latest version in each release line
This commit is contained in:
parent
33b1038eb6
commit
ac8e3f6810
10
.github/actions/docsearch-config.json.hbs
vendored
10
.github/actions/docsearch-config.json.hbs
vendored
@ -1,17 +1,15 @@
|
||||
{
|
||||
"index_name": "spring-security-docs",
|
||||
"start_urls": [
|
||||
{{#each components}}
|
||||
{{#each versions}}
|
||||
{{#each latestVersions}}
|
||||
{
|
||||
"url": "{{{@root.site.url}}}/{{#if (eq ./activeVersionSegment '')}}(?:$|index.html$|[a-z].*){{else}}{{{./activeVersionSegment}}}/{{/if}}",
|
||||
"extra_attributes": {
|
||||
"component": "{{#if (eq ./name 'ROOT')}}spring-security{{else}}{{{./name}}}{{/if}}",
|
||||
"component": "{{#if (eq ./name 'ROOT')}}security{{else}}{{{./name}}}{{/if}}",
|
||||
"version": "{{{./version}}}",
|
||||
"version_rank": {{#if (eq this ../latest)}}1{{else}}2{{/if}}
|
||||
"version_rank": {{#if (eq ./activeVersionSegment '')}}1{{else}}2{{/if}}
|
||||
}
|
||||
}{{#unless (and @last @../last)}},{{/unless}}
|
||||
{{/each}}
|
||||
}{{#unless @last}},{{/unless}}
|
||||
{{/each}}
|
||||
],
|
||||
"sitemap_urls": [
|
||||
|
@ -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' } })
|
||||
})
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user