fix path error

Signed-off-by: zhuxiujuan28 <562873187@qq.com>
This commit is contained in:
zhuxiujuan28 2023-08-30 15:57:10 +08:00
parent 21375e8e3b
commit e1b5f4d3a6
4 changed files with 32 additions and 27 deletions

View File

@ -3,8 +3,13 @@
{
"pattern": "^/[^l][^o][^g].*$",
"function": "go-get",
"name": "go module"
"name": "go-get for go module"
},
{
"pattern": "^(/zh/docs/|/docs/).*$",
"function": "redirect",
"name": "redirect"
}
],
"version": 1
}
}

View File

@ -0,0 +1,24 @@
export default async (req, context) => {
const { url } = req;
const parsedUrl = new URL(url);
const path = parsedUrl.pathname;
const regex = /^(\/zh\/docs|\/docs)\/v[0-9]+\.[0-9]+.*$/;
if (regex.test(path)) {
return;
} else {
let hasContentAfterDocs = false;
const newPath = path.replace(/(\/docs\/)(.*)$/, (match, p1, p2) => {
if (p2.trim() === "") {
return `${p1}v3.4/`;
} else {
hasContentAfterDocs = true;
return `${p1}v3.4/${p2}`;
}
});
const redirectStatusCode = hasContentAfterDocs ? 301 : 302;
const redirectUrl = new URL(newPath, req.url);
return Response.redirect(redirectUrl, redirectStatusCode);
}
};

View File

@ -8,7 +8,7 @@ weight: 1400
2023 年 07 月 26 日KubeSphere 3.4.0 已正式上线。该版本带来了值得大家关注的新功能以及增强:扩大对 Kubernetes 的支持范围,最新稳定性支持 1.26;重构告警策略架构,解耦为告警规则与规则组;提升集群别名展示权重,减少原集群名称不可修改导致的管理问题;升级 KubeEdge 组件到 v1.13 等。同时,还进行了多项修复、优化和增强,更进一步完善交互设计,并全面提升了用户体验。
关于 3.4 新特性的详细解读,可参考博客 [KubeSphere 3.4.0 发布:支持 K8s v1.26](/../../news/kubesphere-3.4.0-ga-announcement/)。
关于 3.4 新特性的详细解读,可参考博客 [KubeSphere 3.4.0 发布:支持 K8s v1.26](/../../../news/kubesphere-3.4.0-ga-announcement/)。
关于 3.4 的新功能及增强、Bug 修复、重要的技术调整,以及废弃或移除的功能,请参见 [3.4.0 版本说明](../../../v3.4/release/release-v340/)。

View File

@ -4,30 +4,6 @@
[context.deploy-preview.environment]
HUGO_VERSION = "0.117.0"
[[redirects]]
from = "/docs"
to = "/docs/v3.3"
status = 302
force = true
[[redirects]]
from = "/zh/docs"
to = "/zh/docs/v3.3"
status = 302
force = true
[[redirects]]
from = "/docs/*"
to = "/docs/v3.4/:splat"
status = 301
force = true
[[redirects]]
from = "/zh/docs/*"
to = "/zh/docs/v3.4/:splat"
status = 301
force = true
[[redirects]]
from = "/log/*"
to = "https://log.kubesphere.io/:splat"