import path from 'node:path';
import { defineConfig } from '@rspress/core';
import { pluginClientRedirects } from '@rspress/plugin-client-redirects';
export default defineConfig({
root: path.join(__dirname, 'doc'),
plugins: [
pluginClientRedirects({
redirects: [
// /docs/old1 -> /docs/new1
{
from: '/docs/old1',
to: '/docs/new1',
},
// redirect from multiple old paths to the new path
{
from: ['/docs/2022', '/docs/2023'],
to: '/docs/2024',
},
// redirect using regular expressions
{
from: '^/docs/old2',
to: '/docs/new2',
},
{
from: '/docs/old3$',
to: '/docs/new3',
},
// redirect to an external URL
{
from: '/docs/old4',
to: 'https://example.com',
},
],
}),
],
});