This is an automated email from the ASF dual-hosted git repository.

chaokunyang pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/fury-site.git


The following commit(s) were added to refs/heads/main by this push:
     new c7f1d7b  fix: fix editUrl error  (#165)
c7f1d7b is described below

commit c7f1d7bdd658d9147e5772d26bef70ec32e11d61
Author: YuLuo <[email protected]>
AuthorDate: Wed Aug 21 22:03:06 2024 +0800

    fix: fix editUrl error  (#165)
    
    - For #161
    - See:
    
https://docusaurus.io/zh-CN/docs/next/api/plugins/@docusaurus/plugin-content-docs#EditUrlFunction
    
    ---------
    
    Signed-off-by: yuluo-yx <[email protected]>
---
 .gitignore           |  3 +++
 docusaurus.config.ts | 32 ++++++++++++++++++++++++--------
 package.json         |  4 ++--
 3 files changed, 29 insertions(+), 10 deletions(-)

diff --git a/.gitignore b/.gitignore
index b2d6de3..2318814 100644
--- a/.gitignore
+++ b/.gitignore
@@ -18,3 +18,6 @@
 npm-debug.log*
 yarn-debug.log*
 yarn-error.log*
+
+# ignore yarn.lock
+yarn.lock
diff --git a/docusaurus.config.ts b/docusaurus.config.ts
index 5d46624..5ac8ac8 100644
--- a/docusaurus.config.ts
+++ b/docusaurus.config.ts
@@ -17,14 +17,14 @@ const config: Config = {
   onBrokenMarkdownLinks: 'warn',
 
    i18n: {
-    defaultLocale: 'eu-US',
-    locales: ['eu-US', 'zh-CN'],
+    defaultLocale: 'en-US',
+    locales: ['en-US', 'zh-CN'],
     path: 'i18n',
     localeConfigs: {
-      'eu-US': {
-        path: "eu-US",
+      'en-US': {
+        path: "en-US",
         label: 'English',
-        htmlLang: 'eu-US',
+        htmlLang: 'en-US',
       },
       'zh-CN': {
         path: "zh-CN",
@@ -40,8 +40,16 @@ const config: Config = {
         docs: {
           sidebarPath: './sidebars.ts',
           editUrl: ({locale, version, docPath }) => {
-            version = version === "current" ? "current" : "version-" + version
-            return 
`https://github.com/apache/fury-site/tree/main/i18n/${locale}/docusaurus-plugin-content-docs/${docPath}`;
+            var editUrl = "";
+            if (locale === "en-US") {
+              editUrl = 
`https://github.com/apache/fury-site/tree/main/docs/${docPath}`;
+            } else if (locale === "zh-CN") {
+              version = version === "current" ? "current" : "version-" + 
version
+              editUrl = 
`https://github.com/apache/fury-site/tree/main/i18n/${locale}/docusaurus-plugin-content-docs/${version}/${docPath}`;
+            } else {
+              editUrl = `https://github.com/apache/fury-site/tree/main`
+            }
+            return editUrl;
           },
         },
         blog: {
@@ -49,7 +57,15 @@ const config: Config = {
           blogSidebarTitle: 'All our posts',
           showReadingTime: true,
           editUrl: ({ blogPath, locale }) => {
-            return 
`https://github.com/apache/fury-site/tree/main/i18n/${locale}/docusaurus-plugin-content-blog/${blogPath}`;
+            var editUrl = "";
+            if (locale === "en-US") {
+              editUrl = 
`https://github.com/apache/fury-site/tree/main/blog/${blogPath}`;
+            } else if (locale === "zh-CN") {
+              editUrl = 
`https://github.com/apache/fury-site/tree/main/i18n/${locale}/docusaurus-plugin-content-blog/${blogPath}`;
+            } else {
+              editUrl =  `https://github.com/apache/fury-site/tree/main`
+            }
+            return editUrl;
           },
         },
         theme: {
diff --git a/package.json b/package.json
index 0f67827..45c87c2 100644
--- a/package.json
+++ b/package.json
@@ -4,8 +4,8 @@
   "private": true,
   "scripts": {
     "docusaurus": "docusaurus",
-    "start": "docusaurus start --locale en-us --host 0.0.0.0",
-    "start-zh": "docusaurus start --locale zh-cn --host 0.0.0.0",
+    "start": "docusaurus start --locale en-US --host 0.0.0.0",
+    "start-zh": "docusaurus start --locale zh-CN --host 0.0.0.0",
     "build": "docusaurus build",
     "swizzle": "docusaurus swizzle",
     "deploy": "docusaurus deploy",


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to