vuepress-plugin-redirect redirecting locales doesn't work in my project #2936
-
I don't know what's wrong, can anyone help me? (The feature is not enabled on the doc of the plugin, by the way, maybe someone can do this as a reference for users.) "devDependencies": {
"@vuepress/plugin-search": "2.0.0-beta.61",
"@vuepress/plugin-shiki": "2.0.0-beta.61",
"core-js-compat": "^3.28.0",
"vuepress": "2.0.0-beta.61",
"vuepress-theme-hope": "2.0.0-beta.197"
}
import { defineUserConfig } from "vuepress";
import { getDirname, path } from "@vuepress/utils";
import searchPlugin from "@vuepress/plugin-search";
import shikiPlugin from "@vuepress/plugin-shiki";
import { redirectPlugin } from "vuepress-plugin-redirect";
import theme from "./theme.js";
const __dirname = getDirname(import.meta.url);
export default defineUserConfig({
lang: "en-US",
title: "...",
description: "...",
locales: {
"/": {
lang: "en-US",
},
"/zh/": {
lang: "zh-CN",
},
},
theme,
markdown: {
importCode: {
handleImportPath: (str) =>
str.replace(/^@docs-root/, path.resolve(__dirname, "..")),
},
},
plugins: [
searchPlugin(),
shikiPlugin({
theme: "one-dark-pro",
}),
redirectPlugin({
autoLocale: true,
localeConfig: {
"/": ["en-US", "en-UK", "en"],
"/zh/": ["zh-CN", "zh-TW", "zh"],
}
}),
],
}); |
Beta Was this translation helpful? Give feedback.
Answered by
Mister-Hope
Mar 21, 2023
Replies: 1 comment 3 replies
-
READ THE Fxxxxxx DOCS PLZhttps://plugin-redirect.vuejs.press/guide.html#redirecting-locales A new feature with option |
Beta Was this translation helpful? Give feedback.
3 replies
Answer selected by
Mister-Hope
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
READ THE Fxxxxxx DOCS PLZ
https://plugin-redirect.vuejs.press/guide.html#redirecting-locales
A new feature with option
autoSwitchLocale: 'modal' | 'directly'
will be released in future.