mirror of
https://github.com/facebook/docusaurus.git
synced 2025-05-02 19:57:25 +02:00
add introduction redirect
This commit is contained in:
parent
0ac5a66a1f
commit
c964a1e3b6
1 changed files with 11 additions and 30 deletions
|
@ -7,6 +7,12 @@
|
||||||
|
|
||||||
const versions = require('./versions.json');
|
const versions = require('./versions.json');
|
||||||
|
|
||||||
|
const allDocHomesPaths = [
|
||||||
|
'/docs',
|
||||||
|
'/docs/next',
|
||||||
|
...versions.slice(1).map((version) => `/docs/${version}`),
|
||||||
|
];
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
title: 'Docusaurus',
|
title: 'Docusaurus',
|
||||||
tagline: 'Build optimized websites quickly, focus on your content',
|
tagline: 'Build optimized websites quickly, focus on your content',
|
||||||
|
@ -25,36 +31,11 @@ module.exports = {
|
||||||
'@docusaurus/plugin-client-redirects',
|
'@docusaurus/plugin-client-redirects',
|
||||||
{
|
{
|
||||||
fromExtensions: ['html'],
|
fromExtensions: ['html'],
|
||||||
redirects: [
|
createRedirects: function (path) {
|
||||||
{
|
// redirect to /docs from /docs/introduction,
|
||||||
to: '/',
|
// as introduction has been made the home doc
|
||||||
from: [
|
if (allDocHomesPaths.includes(path)) {
|
||||||
'/plugin-client-redirects-tests/toHome1',
|
return [`${path}/introduction`];
|
||||||
'/plugin-client-redirects-tests/toHome2',
|
|
||||||
],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
to: '/docs',
|
|
||||||
from: '/plugin-client-redirects-tests/toDocs1',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
to: '/docs',
|
|
||||||
from: '/plugin-client-redirects-tests/toDocs2',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
to: '/docs',
|
|
||||||
from: '/plugin-client-redirects-tests/toHomeDuplicatePath',
|
|
||||||
},
|
|
||||||
],
|
|
||||||
createRedirects: function (existingPath) {
|
|
||||||
if (existingPath === '/') {
|
|
||||||
return [
|
|
||||||
'/',
|
|
||||||
'/docs',
|
|
||||||
'/plugin-client-redirects-tests/toHome3',
|
|
||||||
'/plugin-client-redirects-tests/toHome4',
|
|
||||||
'/plugin-client-redirects-tests/toHomeDuplicatePath',
|
|
||||||
];
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
Loading…
Add table
Reference in a new issue