Skip to content

Commit

Permalink
Allow configuring what version is shown by default (#554)
Browse files Browse the repository at this point in the history
* [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
  • Loading branch information
JoelMarcey authored and yangshun committed May 4, 2018
1 parent 545a053 commit dbc597b
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/server/env.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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)
}
}
}
Expand Down

0 comments on commit dbc597b

Please sign in to comment.