From 0a2a327476f7e680da31ec94447fe5959906a702 Mon Sep 17 00:00:00 2001 From: Eleftheria Stein Date: Tue, 22 Mar 2022 17:34:47 +0100 Subject: [PATCH] Fix reference documentation redirects Closes gh-11018 --- docs/antora/extensions/major-minor-segment.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/docs/antora/extensions/major-minor-segment.js b/docs/antora/extensions/major-minor-segment.js index 3c3761f923..6cf7152b2c 100644 --- a/docs/antora/extensions/major-minor-segment.js +++ b/docs/antora/extensions/major-minor-segment.js @@ -91,6 +91,7 @@ function createSymbolicVersionAlias (component, version, symbolicVersionSegment, function computeOut (src, family, version, htmlUrlExtensionStyle) { let { component, module: module_, basename, extname, relative, stem } = src + if (component === 'ROOT') component = '' if (module_ === 'ROOT') module_ = '' let indexifyPathSegment = '' let familyPathSegment = '' @@ -120,8 +121,11 @@ function computePub (src, out, family, version, htmlUrlExtensionStyle) { const pub = {} let url if (family === 'nav') { - const urlSegments = version ? [src.component, version] : [src.component] - if (src.module && src.module !== 'ROOT') urlSegments.push(src.module) + const component = src.component || 'ROOT' + const urlSegments = component === 'ROOT' ? [] : [component] + if (version) urlSegments.push(version) + const module_ = src.module || 'ROOT' + if (module_ !== 'ROOT') urlSegments.push(module_) // an artificial URL used for resolving page references in navigation model url = '/' + urlSegments.join('/') + '/' pub.moduleRootPath = '.'