fix(v2): redirect plugin: use siteConfig.trailingSlash (#4988)

This commit is contained in:
Sébastien Lorber 2021-06-16 19:04:28 +02:00 committed by GitHub
parent 80b6d9728e
commit b54ec72389
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
15 changed files with 443 additions and 73 deletions

View file

@ -132,34 +132,30 @@ const isVersioningDisabled = !!process.env.DISABLE_VERSIONING || isI18nStaging;
],
[
'@docusaurus/plugin-client-redirects',
isDeployPreview
? // Plugin is disabled for deploy preview because we use trailing slashes on deploy previews
// This plugin is sensitive to trailing slashes, and we don't care much about making it work on deploy previews
{}
: {
fromExtensions: ['html'],
createRedirects: function (path) {
// redirect to /docs from /docs/introduction,
// as introduction has been made the home doc
if (allDocHomesPaths.includes(path)) {
return [`${path}/introduction`];
}
},
redirects: [
{
from: ['/docs/support', '/docs/next/support'],
to: '/community/support',
},
{
from: ['/docs/team', '/docs/next/team'],
to: '/community/team',
},
{
from: ['/docs/resources', '/docs/next/resources'],
to: '/community/resources',
},
],
{
fromExtensions: ['html'],
createRedirects: function (path) {
// redirect to /docs from /docs/introduction,
// as introduction has been made the home doc
if (allDocHomesPaths.includes(path)) {
return [`${path}/introduction`];
}
},
redirects: [
{
from: ['/docs/support', '/docs/next/support'],
to: '/community/support',
},
{
from: ['/docs/team', '/docs/next/team'],
to: '/community/team',
},
{
from: ['/docs/resources', '/docs/next/resources'],
to: '/community/resources',
},
],
},
],
[
'@docusaurus/plugin-ideal-image',