You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by ur...@apache.org on 2022/06/23 05:27:40 UTC

[pulsar-site] 01/03: fix: some md link 404 due to the path missing .md and fix the tab not working due to build script error

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

urfree pushed a commit to branch fix/md-404-and-tab-not-working
in repository https://gitbox.apache.org/repos/asf/pulsar-site.git

commit f9b7948342e074070388c4b5737ba070288426a7
Author: Li Li <ur...@apache.org>
AuthorDate: Thu Jun 23 12:41:49 2022 +0800

    fix: some md link 404 due to the path missing .md and fix the tab not working due to build script error
    
    Signed-off-by: Li Li <ur...@apache.org>
---
 site2/website-next/docker-compose.yaml            | 14 +++++++++++---
 site2/website-next/docusaurus.config.js           | 14 +++++++-------
 site2/website-next/scripts/.htaccess              |  1 +
 site2/website-next/scripts/replace.js             |  3 +++
 site2/website-next/scripts/split-version-build.sh |  4 ++--
 5 files changed, 24 insertions(+), 12 deletions(-)

diff --git a/site2/website-next/docker-compose.yaml b/site2/website-next/docker-compose.yaml
index 77709f822ca..05dc427ea25 100644
--- a/site2/website-next/docker-compose.yaml
+++ b/site2/website-next/docker-compose.yaml
@@ -1,9 +1,17 @@
 version: "3.1"
 services:
-  db:
-    image: nginx:1.18.0-alpine
+  # web:
+  #   image: nginx:1.18.0-alpine
+  #   ports:
+  #     - 80:80
+  #   volumes:
+  #     - ./build:/usr/share/nginx/html
+  #   container_name: psite
+  web:
+    image: httpd:2.4.54-alpine
     ports:
       - 80:80
     volumes:
-      - ./build:/usr/share/nginx/html
+      - ./build:/usr/local/apache2/htdocs
+      - ./scripts/httpd.conf:/usr/local/apache2/conf/httpd.conf
     container_name: psite
\ No newline at end of file
diff --git a/site2/website-next/docusaurus.config.js b/site2/website-next/docusaurus.config.js
index 8af53f1cad8..376a53299cf 100644
--- a/site2/website-next/docusaurus.config.js
+++ b/site2/website-next/docusaurus.config.js
@@ -124,7 +124,6 @@ module.exports = {
     "Apache Pulsar is a cloud-native, distributed messaging and streaming platform originally created at Yahoo! and now a top-level Apache Software Foundation project",
   url: "https://pulsar.apache.org",
   baseUrl: baseUrl,
-  trailingSlash: false,
   onBrokenLinks: "ignore",
   onBrokenMarkdownLinks: "ignore",
   favicon: "img/favicon.ico",
@@ -356,12 +355,6 @@ module.exports = {
     "https://fonts.googleapis.com/css2?family=Red+Hat+Display:wght@300;400;600,900&display=swap",
   ],
   presets: [
-    [
-      "@docusaurus/plugin-client-redirects",
-      {
-        fromExtensions: [""],
-      },
-    ],
     [
       "@docusaurus/preset-classic",
       {
@@ -404,6 +397,13 @@ module.exports = {
     ],
   ],
   plugins: [
+    // [
+    //   "client-redirects",
+    //   /** @type {import('@docusaurus/plugin-client-redirects').Options} */
+    //   ({
+    //     fromExtensions: ["html"],
+    //   }),
+    // ],
     "./postcss-tailwind-loader",
     [
       "content-docs",
diff --git a/site2/website-next/scripts/.htaccess b/site2/website-next/scripts/.htaccess
index cbd040afa9d..7433f6f0ef9 100755
--- a/site2/website-next/scripts/.htaccess
+++ b/site2/website-next/scripts/.htaccess
@@ -1,4 +1,5 @@
 RewriteEngine On
 
+RewriteRule "^en/(.+)$" "/$1" [R=301,DPI,L]
 RewriteRule "^docs/en/(.+)$" "/docs/$1" [R=301,DPI,L]
 RewriteRule "^docs/(zh-CN|zh-TW|ja|ko|fr)/(.+)$" "/$1/docs/$2" [R=301,DPI,L]
\ No newline at end of file
diff --git a/site2/website-next/scripts/replace.js b/site2/website-next/scripts/replace.js
index bd1dec11e24..35b86f33f73 100644
--- a/site2/website-next/scripts/replace.js
+++ b/site2/website-next/scripts/replace.js
@@ -158,6 +158,7 @@ const from = [
   /@pulsar:version_number@/g,
 
   /\[([^\]]*)\]\((\/tools\/pulsar[^\)]*)\)/g,
+  /(\[[^\]]+\]\((?!http|assets|\.|\/|#)((?!\.md|:|\.|#).)*)\)$/g, //fix some relative link 404 due to the path missing .md
 ];
 
 const options = {
@@ -192,6 +193,7 @@ const options = {
     `${latestVersion}`,
 
     '<a href="$2" target="_blank">$1</a>',
+    "$1.md)",
   ],
   dry: false,
 };
@@ -238,6 +240,7 @@ for (v of versions) {
       clientVersionUrl(`${v}`, "admin"),
       `${v}`,
       '<a href="$2" target="_blank">$1</a>',
+      "$1.md)",
     ],
     dry: false,
   };
diff --git a/site2/website-next/scripts/split-version-build.sh b/site2/website-next/scripts/split-version-build.sh
index 2ccdff5d50b..3d53cb212f6 100755
--- a/site2/website-next/scripts/split-version-build.sh
+++ b/site2/website-next/scripts/split-version-build.sh
@@ -20,7 +20,7 @@ function _fileSlash() {
                     dir=$(basename $fname ".$ex")
                     mkdir -p $slashDir/$dir
                     cp -r $file $slashDir/$dir/index.html
-                    node scripts/fix-index.js $slashDir/$dir/index.html
+                    # node scripts/fix-index.js $slashDir/$dir/index.html
                 fi
             fi
         done
@@ -72,7 +72,7 @@ function _buildVersion() {
     _build
 
     if [[ $buildVersion != $latest ]]; then
-        _copySlash
+        # _copySlash
 
         mkdir -p build-${buildVersion}/${buildVersion} #build-${buildVersion}/${buildVersion}.md
         cp -r build/docs/${buildVersion}/* build-${buildVersion}/${buildVersion}