%# --------------------------------------------------------------- # docmd : the zero-config documentation engine. # @website https://docmd.io # [docmd-source] - Please do not remove this header. # --------------------------------------------------------------- %> <% if (allLocales && allLocales.length > 1) { const current = activeLocale || allLocales.find(l => l.id === defaultLocale); const isCompact = typeof compact !== 'undefined' && compact; // Compute current page path relative to locale root // Strip the active locale prefix if present (outputPrefix bakes it into navPath now) let pagePath = (typeof currentPagePath !== 'undefined' && currentPagePath) ? currentPagePath.replace(/^\//, '') : ''; const activeLocaleId = activeLocale ? activeLocale.id : null; if (activeLocaleId && activeLocaleId !== defaultLocale && pagePath.startsWith(activeLocaleId + '/')) { pagePath = pagePath.slice(activeLocaleId.length + 1); } // Get the active version prefix if versioning is active const activeVersion = config._activeVersion; const currentVersionId = config.versions && config.versions.current; const isOldVersion = activeVersion && currentVersionId && activeVersion.id !== currentVersionId; const versionPrefix = isOldVersion ? activeVersion.id + '/' : ''; // Strip version prefix from pagePath if it's already baked in (avoids duplication) if (versionPrefix && pagePath.startsWith(versionPrefix)) { pagePath = pagePath.slice(versionPrefix.length); } // Determine which locales are available for this version // Old versions without locale subdirectories only support the default locale const versionHasI18n = !isOldVersion || (typeof config._versionHasI18n !== 'undefined' ? config._versionHasI18n : !isOldVersion); %>