This is an automated email from the ASF dual-hosted git repository.
liuqiufeng pushed a commit to branch docusaurus
in repository https://gitbox.apache.org/repos/asf/incubator-seata-website.git
The following commit(s) were added to refs/heads/docusaurus by this push:
new 48eff750b79 optimize: old download url compatible (#926)
48eff750b79 is described below
commit 48eff750b79134ea8c7ef97394550a05ded17652
Author: liuqiufeng <[email protected]>
AuthorDate: Sun Dec 15 01:48:52 2024 +0800
optimize: old download url compatible (#926)
---
docusaurus.config.js | 2 +-
src/urlCompatible.ts | 10 ++++++++++
2 files changed, 11 insertions(+), 1 deletion(-)
diff --git a/docusaurus.config.js b/docusaurus.config.js
index 220963e20a9..7722b146c31 100644
--- a/docusaurus.config.js
+++ b/docusaurus.config.js
@@ -44,7 +44,7 @@ const config = {
// Even if you don't use internalization, you can use this field to set
useful
// metadata like html lang. For example, if your site is Chinese, you may
want
// to replace "en" with "zh-Hans".
- clientModules: [require.resolve('./src/analytics.ts')],
+ clientModules:
[require.resolve('./src/analytics.ts'),require.resolve('./src/urlCompatible.ts')],
i18n: {
defaultLocale: 'en',
locales: ['en', 'zh-cn'],
diff --git a/src/urlCompatible.ts b/src/urlCompatible.ts
new file mode 100644
index 00000000000..cb9395a979b
--- /dev/null
+++ b/src/urlCompatible.ts
@@ -0,0 +1,10 @@
+import type { ClientModule } from '@docusaurus/types';
+// This module is used to redirect the old URL to the new URL.
+const module: ClientModule = {
+ onRouteUpdate({ location }) {
+ if (location.pathname.includes('/unversioned/')) {
+ window.location.href = location.pathname.replace('/unversioned/', '/');
+ }
+ },
+};
+export default module;
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]