|
123 | 123 | return undefined |
124 | 124 | } |
125 | 125 |
|
| 126 | + // A continuously-deployed/unversioned component (Capella, AI Data Plane, |
| 127 | + // etc.) has a genuine version of "" in Antora, not a missing one -- a |
| 128 | + // plain truthiness check would silently drop it (same reasoning as the |
| 129 | + // ['', 'master'].includes(...) checks elsewhere in this file, just |
| 130 | + // inverted: there, '' means "don't show a redundant version picker"; |
| 131 | + // here, '' must still count as "this component has a real, includable |
| 132 | + // version"). |
| 133 | + function hasVersion (versionMap, name) { |
| 134 | + return versionMap && Object.prototype.hasOwnProperty.call(versionMap, name) |
| 135 | + } |
| 136 | + |
126 | 137 | function computeDefaultRefinement () { |
127 | 138 | var pageUrl = metaContent('page-url') |
128 | 139 | var landingGroup = pageUrl ? findGroupByUrl(componentCatalog.navGroups, pageUrl) : undefined |
129 | 140 | if (landingGroup) { |
130 | | - return landingGroup.components |
131 | | - .filter(function (c) { return landingGroup.latestVersions && landingGroup.latestVersions[c.name] }) |
| 141 | + return (landingGroup.components || []) |
| 142 | + .filter(function (c) { return hasVersion(landingGroup.latestVersions, c.name) }) |
132 | 143 | .map(function (c) { return c.name + '@' + landingGroup.latestVersions[c.name] }) |
133 | 144 | } |
134 | 145 | var component = metaContent('docsearch:component') |
135 | 146 | var version = metaContent('docsearch:cversion') |
136 | | - return component && version ? [component + '@' + version] : [] |
| 147 | + // "home" pages are landing/informational content (the site index, and |
| 148 | + // every home::*.adoc category landing page not already caught above by |
| 149 | + // its own group's url match) -- nav-group-for-page.js already treats |
| 150 | + // these as belonging to no specific group for the same reason, so don't |
| 151 | + // default search to "home"'s own (largely meaningless) component here. |
| 152 | + if (!component || component === 'home' || version === undefined) return [] |
| 153 | + return [component + '@' + version] |
137 | 154 | } |
138 | 155 |
|
139 | 156 | // The refinementList widget only ever exposes component_version values that |
|
0 commit comments