mirror of
https://github.com/facebook/docusaurus.git
synced 2025-08-03 00:39:45 +02:00
feat(v2): docs version configuration: lastVersion, version.{path,label} (#3357)
* add new docs versioning options * Add some tests for new versioning options * Add some docs for version configurations * try to fix broken link detection after /docs/ root paths have been removed on deploy previews * improve dev/deploypreview versioning configurations * disable custom current version path, as it produces broken links * readVersionDocs should not be order sensitive * fix versions page according to versioning config * fix versions page according to versioning config
This commit is contained in:
parent
4bfc3bbbe7
commit
ae877f2990
15 changed files with 387 additions and 79 deletions
|
@ -14,13 +14,15 @@ const allDocHomesPaths = [
|
|||
...versions.slice(1).map((version) => `/docs/${version}/`),
|
||||
];
|
||||
|
||||
const isDev = process.env.NODE_ENV === 'development';
|
||||
|
||||
const isDeployPreview =
|
||||
process.env.NETLIFY && process.env.CONTEXT === 'deploy-preview';
|
||||
|
||||
const baseUrl = process.env.BASE_URL || '/';
|
||||
const isBootstrapPreset = process.env.DOCUSAURUS_PRESET === 'bootstrap';
|
||||
const isVersioningDisabled = !!process.env.DISABLE_VERSIONING;
|
||||
|
||||
if (isBootstrapPreset) {
|
||||
console.log('Will use bootstrap preset!');
|
||||
}
|
||||
const isVersioningDisabled = !!process.env.DISABLE_VERSIONING;
|
||||
|
||||
module.exports = {
|
||||
title: 'Docusaurus',
|
||||
|
@ -175,6 +177,16 @@ module.exports = {
|
|||
showLastUpdateTime: true,
|
||||
remarkPlugins: [require('./src/plugins/remark-npm2yarn')],
|
||||
disableVersioning: isVersioningDisabled,
|
||||
lastVersion: isDev || isDeployPreview ? 'current' : undefined,
|
||||
versions: {
|
||||
current: {
|
||||
// path: isDev || isDeployPreview ? '' : 'next',
|
||||
label:
|
||||
isDev || isDeployPreview
|
||||
? `Next (${isDeployPreview ? 'deploy preview' : 'dev'})`
|
||||
: 'Next',
|
||||
},
|
||||
},
|
||||
},
|
||||
blog: {
|
||||
// routeBasePath: '/',
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue