mirror of
https://github.com/facebook/docusaurus.git
synced 2025-05-16 10:37:20 +02:00
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:
parent
545a053289
commit
dbc597bfd7
1 changed files with 4 additions and 1 deletions
|
@ -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)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue