ice/website/plugins/redirect.js

95 lines
2.5 KiB
JavaScript
Raw Normal View History

const path = require('path');
module.exports = function (config) {
return {
name: 'docusaurus-redirect-plugin',
async contentLoaded({ actions }) {
2022-02-23 11:24:50 +08:00
const { createData, addRoute } = actions;
const routes = [
文档 (#203) * feat: docs directory * docs: 调整结构 * chore: lock * feat: update docs * docs: update assets doc * 新增文档 for 介绍 and 环境变量 (#307) * docs: add about * docs: add docs for env * docs: update about * docs: config (#306) * docs: router (#304) * docs: router * feat: getconfig * docs: get data * docs: ssg * docs: ssr * docs: document * docs: page * docs: enable ssr * fix: title * Doc/rax compat (#303) * docs: add docs of rax-compat * docs: modify doc of rax compat * Docs: app entry (#301) * docs: app entry * docs: app entry * docs: mock (#245) * docs: mock * chore: typo * chore: title * docs: styles (#244) * docs: style * chore: acss title * Docs: contributing (#243) * docs: contributing * chore: typo * chore: update contributing docs * fix: typo * chore: add putteteer install * docs: quick start (#235) * docs: quick start * chore: update IDE * chore: update docs * docs: app directory (#236) * docs: directory * chore: document desc * docs: update website * docs: update about * docs: update docs * chore: update prism * chore: update docs * chore: update Co-authored-by: luhc228 <luhengchang228@126.com> Co-authored-by: ClarkXia <xiawenwu41@gmail.com> Co-authored-by: 逆葵 <xianyong.yxy@alibaba-inc.com> Co-authored-by: ZeroLing <zhuoling.lcl@alibaba-inc.com> Co-authored-by: ZeroLing <i@zeroling.com> Co-authored-by: 水澜 <shuilan.cj@taobao.com> Co-authored-by: 染陌同学 <answershuto@gmail.com> Co-authored-by: luhc228 <44047106+luhc228@users.noreply.github.com>
2022-07-01 16:47:25 +08:00
// {
// from: '/docs/guide/advance/fusion',
// to: '/docs/plugin/list/fusion',
// },
// {
// from: '/docs/guide/advance/antd',
// to: '/docs/plugin/list/antd',
// },
// {
// from: '/docs/guide/develop/plugin-dev',
// to: '/docs/plugin/develop/start',
// },
// {
// from: '/docs/guide/develop/plugin-build',
// to: '/docs/plugin/develop/build',
// },
// {
// from: '/docs/guide/develop/plugin-runtime',
// to: '/docs/plugin/develop/runtime',
// },
// {
// from: '/docs/guide/develop/plugin-list',
// to: '/docs/plugin/list/moment-locales',
// },
// {
// from: '/docs/guide/basic/api',
// to: '/docs/config/about',
// },
];
const redirectConfigPath = await createData(
'redirectConfig.json',
JSON.stringify(routes),
);
routes.forEach((item) => {
addRoute({
path: item.from,
component: '@site/src/components/Redirect',
modules: {
// propName -> JSON file path
redirectConfig: redirectConfigPath,
},
exact: true,
});
});
2022-02-23 11:24:50 +08:00
addRoute({
path: path.join(config.baseUrl, '/component'),
component: '@site/src/components/Redirect',
modules: {
// propName -> JSON file path
redirectConfig: redirectConfigPath,
},
});
addRoute({
path: path.join(config.baseUrl, '/docs/guide/advance'),
component: '@site/src/components/Redirect',
modules: {
// propName -> JSON file path
redirectConfig: redirectConfigPath,
},
});
addRoute({
path: path.join(config.baseUrl, '/docs/materials'),
component: '@site/src/components/Redirect',
modules: {
// propName -> JSON file path
redirectConfig: redirectConfigPath,
},
});
addRoute({
path: path.join(config.baseUrl, '/docs/icestark'),
component: '@site/src/components/Redirect',
modules: {
// propName -> JSON file path
redirectConfig: redirectConfigPath,
},
});
},
};
};