Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions _config.yml
Original file line number Diff line number Diff line change
@@ -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
Expand Down
17 changes: 14 additions & 3 deletions assets/js/_version-selector.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) => `<a href="/docs/${v}/${pathName}"${idx === 0 ? ' class="latest"' : ''}>${PREFIX}${v}.x</a>`)
.join('');
const pathName = location.pathname.replace(/^\/(latest|\d+\.\d+)(\/)?/, '');
const versionsDOMNodes = DOC_VERSIONS.map((v, idx) => v === DOC_VERSION_LATEST
? `<a href="/latest/${pathName}" class="latest">${PREFIX}${v}</a>`
: `<a href="/${v}/${pathName}">${PREFIX}${v}</a>`,
);
if (Array.isArray(DOC_VERSIONS_ARCHIVED) && DOC_VERSIONS_ARCHIVED.length) {
versionsDOMNodes.push(
`<a class="show-archived"><span>Show archived</span><svg xmlns="http://www.w3.org/2000/svg" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 24 24"><g fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M6 9l6 6l6-6"/></g></svg></a>`,
`<a class="archived">Archived</a>`,
...DOC_VERSIONS_ARCHIVED.map((v, idx) => `<a href="/${v}/${pathName}">${PREFIX}${v}</a>`)
);
}

const versionsDOMText = versionsDOMNodes.join('');

frag.querySelector('#dropdown').appendChild(this._makeFragment(versionsDOMText));
frag.querySelector('#spacer').appendChild(this._makeFragment(versionsDOMText));
Expand Down
Loading