mirror of
https://github.com/facebook/docusaurus.git
synced 2025-06-15 09:12:24 +02:00
Rename latestVersion to defaultVersion (#639)
* Rename lastVersion to defaultVersion * Added defaultVersionShown to site-config doc * Remove defaultVersionShown from siteConfig * Update api-site-config.md
This commit is contained in:
parent
dbc597bfd7
commit
5771549e75
5 changed files with 12 additions and 8 deletions
|
@ -84,6 +84,9 @@ customDocsPath: 'docs/site'
|
||||||
```js
|
```js
|
||||||
customDocsPath: 'website-docs'
|
customDocsPath: 'website-docs'
|
||||||
```
|
```
|
||||||
|
|
||||||
|
`defaultVersionShown` - The default version for the site to be shown. If this is not set, the latest version will be shown.
|
||||||
|
|
||||||
`disableHeaderTitle` - An option to disable showing the title in the header next to the header icon. Exclude this field to keep the header as normal, otherwise set to `true`.
|
`disableHeaderTitle` - An option to disable showing the title in the header next to the header icon. Exclude this field to keep the header as normal, otherwise set to `true`.
|
||||||
|
|
||||||
`disableTitleTagline` - An option to disable showing the tagline in the title of main pages. Exclude this field to keep page titles as `Title • Tagline`. Set to `true` to make page titles just `Title`.
|
`disableTitleTagline` - An option to disable showing the tagline in the title of main pages. Exclude this field to keep page titles as `Title • Tagline`. Set to `true` to make page titles just `Title`.
|
||||||
|
@ -181,6 +184,7 @@ const siteConfig = {
|
||||||
// For github.io type URLS, you would combine the url and baseUrl like:
|
// For github.io type URLS, you would combine the url and baseUrl like:
|
||||||
// url: 'https://reasonml.github.io',
|
// url: 'https://reasonml.github.io',
|
||||||
// baseUrl: '/reason-react/',
|
// baseUrl: '/reason-react/',
|
||||||
|
defaultVersionShown: '1.0.0',
|
||||||
organizationName: 'facebook',
|
organizationName: 'facebook',
|
||||||
projectName: 'docusaurus',
|
projectName: 'docusaurus',
|
||||||
noIndex: false,
|
noIndex: false,
|
||||||
|
|
|
@ -144,7 +144,7 @@ class HeaderNav extends React.Component {
|
||||||
const versionPart =
|
const versionPart =
|
||||||
env.versioning.enabled && this.props.version !== 'next'
|
env.versioning.enabled && this.props.version !== 'next'
|
||||||
? 'version-' +
|
? 'version-' +
|
||||||
(this.props.version || env.versioning.latestVersion) +
|
(this.props.version || env.versioning.defaultVersion) +
|
||||||
'-'
|
'-'
|
||||||
: '';
|
: '';
|
||||||
const id = langPart + versionPart + link.doc;
|
const id = langPart + versionPart + link.doc;
|
||||||
|
@ -243,7 +243,7 @@ class HeaderNav extends React.Component {
|
||||||
</a>
|
</a>
|
||||||
{env.versioning.enabled && (
|
{env.versioning.enabled && (
|
||||||
<a href={versionsLink}>
|
<a href={versionsLink}>
|
||||||
<h3>{this.props.version || env.versioning.latestVersion}</h3>
|
<h3>{this.props.version || env.versioning.defaultVersion}</h3>
|
||||||
</a>
|
</a>
|
||||||
)}
|
)}
|
||||||
{this.renderResponsiveNav()}
|
{this.renderResponsiveNav()}
|
||||||
|
|
|
@ -44,7 +44,7 @@ class Translation {
|
||||||
class Versioning {
|
class Versioning {
|
||||||
constructor() {
|
constructor() {
|
||||||
this.enabled = false;
|
this.enabled = false;
|
||||||
this.latestVersion = null;
|
this.defaultVersion = null;
|
||||||
this.versions = [];
|
this.versions = [];
|
||||||
|
|
||||||
this._load();
|
this._load();
|
||||||
|
@ -54,7 +54,7 @@ class Versioning {
|
||||||
if (fs.existsSync(versions_json)) {
|
if (fs.existsSync(versions_json)) {
|
||||||
this.enabled = true;
|
this.enabled = true;
|
||||||
this.versions = JSON.parse(fs.readFileSync(versions_json, 'utf8'));
|
this.versions = JSON.parse(fs.readFileSync(versions_json, 'utf8'));
|
||||||
this.latestVersion = siteConfig.defaultVersionShown
|
this.defaultVersion = siteConfig.defaultVersionShown
|
||||||
? siteConfig.defaultVersionShown
|
? siteConfig.defaultVersionShown
|
||||||
: this.versions[0]; // otherwise show the latest version (other than next/master)
|
: this.versions[0]; // otherwise show the latest version (other than next/master)
|
||||||
}
|
}
|
||||||
|
|
|
@ -143,7 +143,7 @@ async function execute() {
|
||||||
rawContent = insertTableOfContents(rawContent);
|
rawContent = insertTableOfContents(rawContent);
|
||||||
}
|
}
|
||||||
|
|
||||||
let latestVersion = env.versioning.latestVersion;
|
let defaultVersion = env.versioning.defaultVersion;
|
||||||
|
|
||||||
// replace any links to markdown files to their website html links
|
// replace any links to markdown files to their website html links
|
||||||
Object.keys(mdToHtml).forEach(function(key, index) {
|
Object.keys(mdToHtml).forEach(function(key, index) {
|
||||||
|
@ -151,7 +151,7 @@ async function execute() {
|
||||||
link = link.replace('/en/', '/' + language + '/');
|
link = link.replace('/en/', '/' + language + '/');
|
||||||
link = link.replace(
|
link = link.replace(
|
||||||
'/VERSION/',
|
'/VERSION/',
|
||||||
metadata.version && metadata.version !== latestVersion
|
metadata.version && metadata.version !== defaultVersion
|
||||||
? '/' + metadata.version + '/'
|
? '/' + metadata.version + '/'
|
||||||
: '/'
|
: '/'
|
||||||
);
|
);
|
||||||
|
|
|
@ -190,7 +190,7 @@ function execute(port) {
|
||||||
rawContent = insertTableOfContents(rawContent);
|
rawContent = insertTableOfContents(rawContent);
|
||||||
}
|
}
|
||||||
|
|
||||||
let latestVersion = env.versioning.latestVersion;
|
let defaultVersion = env.versioning.defaultVersion;
|
||||||
|
|
||||||
// replace any links to markdown files to their website html links
|
// replace any links to markdown files to their website html links
|
||||||
Object.keys(mdToHtml).forEach(function(key, index) {
|
Object.keys(mdToHtml).forEach(function(key, index) {
|
||||||
|
@ -198,7 +198,7 @@ function execute(port) {
|
||||||
link = link.replace('/en/', '/' + language + '/');
|
link = link.replace('/en/', '/' + language + '/');
|
||||||
link = link.replace(
|
link = link.replace(
|
||||||
'/VERSION/',
|
'/VERSION/',
|
||||||
metadata.version && metadata.version !== latestVersion
|
metadata.version && metadata.version !== defaultVersion
|
||||||
? '/' + metadata.version + '/'
|
? '/' + metadata.version + '/'
|
||||||
: '/'
|
: '/'
|
||||||
);
|
);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue