You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by ju...@apache.org on 2021/11/03 04:39:55 UTC
[apisix-website] 01/01: fix: use correct editUrl
This is an automated email from the ASF dual-hosted git repository.
juzhiyuan pushed a commit to branch fix-editUrl
in repository https://gitbox.apache.org/repos/asf/apisix-website.git
commit ff90c96a2f8f06933c4155a570db5d7ba7b71b59
Author: juzhiyuan <ju...@apache.org>
AuthorDate: Wed Nov 3 12:38:59 2021 +0800
fix: use correct editUrl
---
website/docusaurus.config.js | 88 ++++++++++++++++++++++++++++++++++++++------
1 file changed, 77 insertions(+), 11 deletions(-)
diff --git a/website/docusaurus.config.js b/website/docusaurus.config.js
index ec954cd..ac86bbb 100644
--- a/website/docusaurus.config.js
+++ b/website/docusaurus.config.js
@@ -1,5 +1,16 @@
const { ssrTemplate } = require('./config/ssrTemplate');
+const getEditUrl = ({
+ projectName,
+ version,
+ locale,
+ docPath,
+ defaultBranch = "master"
+}) => {
+ const branch = version === 'current' ? defaultBranch : `release/${version}`;
+ return `https://github.com/apache/${projectName}/edit/${branch}/docs/${locale}/latest/${docPath}`;
+}
+
module.exports = {
title: "Apache APISIX® -- Cloud-Native API Gateway",
tagline:
@@ -293,11 +304,16 @@ module.exports = {
routeBasePath: "/docs/apisix",
sidebarPath: require.resolve("./docs/apisix/sidebars.json"),
editUrl: function ({
- locale,
docPath,
+ version,
+ locale
}) {
- // TODO: support Edit on multiple versions/branches
- return `https://github.com/apache/apisix/edit/master/docs/${locale}/latest/${docPath}`;
+ return getEditUrl({
+ projectName: "apisix",
+ locale,
+ docPath,
+ version
+ })
},
},
],
@@ -312,8 +328,15 @@ module.exports = {
sidebarPath: require.resolve("./docs/apisix-dashboard/sidebars.json"),
editUrl: function ({
docPath,
+ version,
+ locale
}) {
- return `https://github.com/apache/apisix-dashboard/edit/master/docs/en/latest/${docPath}`;
+ return getEditUrl({
+ projectName: "apisix-dashboard",
+ locale,
+ docPath,
+ version
+ })
},
},
],
@@ -330,8 +353,15 @@ module.exports = {
),
editUrl: function ({
docPath,
+ version,
+ locale
}) {
- return `https://github.com/apache/apisix-ingress-controller/edit/master/docs/en/latest/${docPath}`;
+ return getEditUrl({
+ projectName: "apisix-ingress-controller",
+ locale,
+ docPath,
+ version
+ })
},
},
],
@@ -346,8 +376,15 @@ module.exports = {
sidebarPath: require.resolve("./docs/apisix-helm-chart/sidebars.json"),
editUrl: function ({
docPath,
+ version,
+ locale
}) {
- return `https://github.com/apache/apisix-helm-chart/edit/master/docs/en/latest/${docPath}`;
+ return getEditUrl({
+ projectName: "apisix-helm-chart",
+ locale,
+ docPath,
+ version
+ })
},
},
],
@@ -362,8 +399,15 @@ module.exports = {
sidebarPath: require.resolve("./docs/apisix-docker/sidebars.json"),
editUrl: function ({
docPath,
+ version,
+ locale
}) {
- return `https://github.com/apache/apisix-docker/edit/master/docs/en/latest/${docPath}`;
+ return getEditUrl({
+ projectName: "apisix-docker",
+ locale,
+ docPath,
+ version
+ })
},
},
],
@@ -378,8 +422,16 @@ module.exports = {
sidebarPath: require.resolve("./docs/apisix-java-plugin-runner/sidebars.json"),
editUrl: function ({
docPath,
+ version,
+ locale
}) {
- return `https://github.com/apache/apisix-java-plugin-runner/edit/main/docs/en/latest/${docPath}`;
+ return getEditUrl({
+ projectName: "apisix-java-plugin-runner",
+ locale,
+ docPath,
+ version,
+ defaultBranch: "main"
+ })
},
},
],
@@ -394,8 +446,15 @@ module.exports = {
sidebarPath: require.resolve("./docs/apisix-go-plugin-runner/sidebars.json"),
editUrl: function ({
docPath,
+ version,
+ locale
}) {
- return `https://github.com/apache/apisix-go-plugin-runner/edit/master/docs/en/latest/${docPath}`;
+ return getEditUrl({
+ projectName: "apisix-go-plugin-runner",
+ locale,
+ docPath,
+ version,
+ })
},
},
],
@@ -410,8 +469,15 @@ module.exports = {
sidebarPath: require.resolve("./docs/apisix-python-plugin-runner/sidebars.json"),
editUrl: function ({
docPath,
+ version,
+ locale
}) {
- return `https://github.com/apache/apisix-python-plugin-runner/edit/master/docs/en/latest/${docPath}`;
+ return getEditUrl({
+ projectName: "apisix-python-plugin-runner",
+ locale,
+ docPath,
+ version,
+ })
},
},
],
@@ -647,5 +713,5 @@ module.exports = {
* We need to check if we build site for preview env, or preview site will load static assets from the asf-site branch.
* See ssrTemplate -> jsDelivr
*/
- ssrTemplate
+ ssrTemplate
};