diff --git a/_config.yml b/_config.yml index df2e0c4d95c..755596b2ec8 100644 --- a/_config.yml +++ b/_config.yml @@ -1,8 +1,8 @@ title: OpenSearch documentation description: >- # this means to ignore newlines until "baseurl:" Documentation for OpenSearch, the Apache 2.0 search, analytics, and visualization suite with advanced security, alerting, SQL support, automated index management, deep performance analysis, and more. -baseurl: "/docs/latest" # the subpath of your site, e.g. /blog -url: "https://opensearch.org" # the base hostname & protocol for your site, e.g. http://example.com +baseurl: "/latest" # the subpath of your site, e.g. /blog +url: "https://docs.opensearch.org" # the base hostname & protocol for your site, e.g. http://example.com permalink: /:path/ opensearch_version: 1.2.4 diff --git a/assets/js/_version-selector.js b/assets/js/_version-selector.js index cee949594a8..aa7472261f8 100644 --- a/assets/js/_version-selector.js +++ b/assets/js/_version-selector.js @@ -154,9 +154,20 @@ class VersionSelector extends HTMLElement { frag.querySelector('#selected').textContent = `${PREFIX}${this.getAttribute('selected')}.x`; - const pathName = location.pathname.replace(/\/docs(\/((latest|\d+\.\d+)\/?)?)?/, ''); - const versionsDOMText = DOC_VERSIONS.map((v, idx) => `${PREFIX}${v}.x`) - .join(''); + const pathName = location.pathname.replace(/^\/(latest|\d+\.\d+)(\/)?/, ''); + const versionsDOMNodes = DOC_VERSIONS.map((v, idx) => v === DOC_VERSION_LATEST + ? `${PREFIX}${v}` + : `${PREFIX}${v}`, + ); + if (Array.isArray(DOC_VERSIONS_ARCHIVED) && DOC_VERSIONS_ARCHIVED.length) { + versionsDOMNodes.push( + `Show archived`, + `Archived`, + ...DOC_VERSIONS_ARCHIVED.map((v, idx) => `${PREFIX}${v}`) + ); + } + + const versionsDOMText = versionsDOMNodes.join(''); frag.querySelector('#dropdown').appendChild(this._makeFragment(versionsDOMText)); frag.querySelector('#spacer').appendChild(this._makeFragment(versionsDOMText));