You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@fory.apache.org by ch...@apache.org on 2026/08/13 11:05:33 UTC

(fory-site) branch fix_redirect updated: fix: redirect legacy language guides

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

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


The following commit(s) were added to refs/heads/fix_redirect by this push:
     new 85966baa8f fix: redirect legacy language guides
85966baa8f is described below

commit 85966baa8f1dae40ea38ca9df2312a16412aa82d
Author: chaokunyang <sh...@gmail.com>
AuthorDate: Thu Aug 13 19:05:00 2026 +0800

    fix: redirect legacy language guides
---
 src/plugin/redirect.js | 23 +++++++++++++++++++++--
 static/.htaccess       |  8 +++++---
 2 files changed, 26 insertions(+), 5 deletions(-)

diff --git a/src/plugin/redirect.js b/src/plugin/redirect.js
index ead2d8e7f1..fbd704bf4e 100644
--- a/src/plugin/redirect.js
+++ b/src/plugin/redirect.js
@@ -4,6 +4,19 @@ export default function (context, options) {
         (version) => typeof version === 'string',
       )
     : [];
+  const objectSerializationGuideEntries = [
+    'cpp',
+    'csharp',
+    'dart',
+    'go',
+    'java',
+    'javascript',
+    'kotlin',
+    'python',
+    'rust',
+    'scala',
+    'swift',
+  ];
 
   return {
     name: "redirect-plugin",
@@ -77,6 +90,11 @@ export default function (context, options) {
                 }
 
                 var oldPath = segments.slice(pathIndex).join('/');
+                var objectSerializationGuideEntries = ${JSON.stringify(objectSerializationGuideEntries)};
+                var guidePath = oldPath.split('/');
+                var guideEntry = guidePath.length === 2 && guidePath[0] === 'guide'
+                  ? guidePath[1]
+                  : null;
                 var routes = {
                   'introduction/overview': 'introduction',
                   'introduction/benchmark': 'benchmarks',
@@ -86,7 +104,6 @@ export default function (context, options) {
                   'guide/xlang/getting_started': 'object-serialization/xlang',
                   'guide/xlang/serialization': 'object-serialization/xlang',
                   'guide/java/json_support': 'json',
-                  'guide/rust': 'object-serialization/rust',
                   'guide/rust/external_types': 'object-serialization/rust/external-types',
                   'guide/dart/external_types': 'object-serialization/dart/external-types',
                   'guide/swift/external_types': 'object-serialization/swift/external-types',
@@ -97,7 +114,9 @@ export default function (context, options) {
                   'compiler/compiler_guide': 'compiler/getting-started',
                   'community/development': 'development',
                 };
-                var destination = routes[oldPath];
+                var destination = guideEntry && objectSerializationGuideEntries.indexOf(guideEntry) >= 0
+                  ? 'object-serialization/' + guideEntry
+                  : routes[oldPath];
                 if (!destination) {
                   return;
                 }
diff --git a/static/.htaccess b/static/.htaccess
index b936d84092..1613eb9cd0 100644
--- a/static/.htaccess
+++ b/static/.htaccess
@@ -15,9 +15,11 @@
 # specific language governing permissions and limitations
 # under the License.
 
-# This redirect must run before Apache handles the request as a 404; client-side
-# Docusaurus redirects never execute when the origin serves its stock 404 page.
-RedirectMatch 301 "^/docs/guide/rust/?$" "https://fory.apache.org/docs/object-serialization/rust/"
+# These redirects must run before Apache handles the request as a 404;
+# client-side Docusaurus redirects never execute when the origin serves its
+# stock 404 page. Keep the entry list aligned with
+# objectSerializationGuideEntries in src/plugin/redirect.js.
+RedirectMatch 301 "^/(zh-CN/)?docs/(next/)?guide/(cpp|csharp|dart|go|java|javascript|kotlin|python|rust|scala|swift)/?$" "https://fory.apache.org/$1docs/$2object-serialization/$3/"
 
 # Keep arbitrary missing URLs temporary so stale typos are not cached forever.
 ErrorDocument 404 "https://fory.apache.org/"


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@fory.apache.org
For additional commands, e-mail: commits-help@fory.apache.org