diff --git a/lib/core/Site.js b/lib/core/Site.js index 40823ad948d2..6ac9a235b286 100644 --- a/lib/core/Site.js +++ b/lib/core/Site.js @@ -30,7 +30,7 @@ class Site extends React.Component { this.props.config.url + this.props.config.baseUrl + (this.props.url || 'index.html'); - let latestVersion; + let docsVersion = this.props.version || 'current'; const highlightDefaultVersion = '9.12.0'; const highlightConfig = this.props.config.highlight || { @@ -39,7 +39,10 @@ class Site extends React.Component { }; const highlightVersion = highlightConfig.version || highlightDefaultVersion; if (fs.existsSync(CWD + '/versions.json')) { - latestVersion = require(CWD + '/versions.json')[0]; + const latestVersion = require(CWD + '/versions.json')[0]; + if (docsVersion === latestVersion) { + docsVersion = 'current'; + } } // We do not want a lang attribute for the html tag if we don't have a language set @@ -122,7 +125,7 @@ class Site extends React.Component { algoliaOptions: ${JSON.stringify( this.props.config.algolia.algoliaOptions ) - .replace('VERSION', this.props.version || latestVersion) + .replace('VERSION', docsVersion) .replace('LANGUAGE', this.props.language)} }); `,