Allow configuring what version is shown by default (#554)

* [RFC] Allow configure what version is shown by default

Seeing if this will work - it won't work if you want to show `master` or `next` by default.
Only named version that would exist in `versioned_docs`.

If this does work and we want to go with it - `latestVersion` in many places seems like a
misnomer. `defaultVersion` would be better or something

* Remove from docusaurus siteconfig
This commit is contained in:
Joel Marcey 2018-05-04 10:00:46 -07:00 committed by Yangshun Tay
parent 545a053289
commit dbc597bfd7

View file

@ -8,6 +8,7 @@
const CWD = process.cwd();
const fs = require('fs-extra');
const path = require('path');
const siteConfig = require(CWD + '/siteConfig.js');
const join = path.join;
@ -53,7 +54,9 @@ class Versioning {
if (fs.existsSync(versions_json)) {
this.enabled = true;
this.versions = JSON.parse(fs.readFileSync(versions_json, 'utf8'));
this.latestVersion = this.versions[0];
this.latestVersion = siteConfig.defaultVersionShown
? siteConfig.defaultVersionShown
: this.versions[0]; // otherwise show the latest version (other than next/master)
}
}
}