diff --git a/content/en/docs/v4.1/_index.adoc b/content/en/docs/v4.1/_index.adoc
index 4210f82ef..aeddf45f8 100644
--- a/content/en/docs/v4.1/_index.adoc
+++ b/content/en/docs/v4.1/_index.adoc
@@ -8,6 +8,7 @@ section1:
title: KubeSphere Documentation
content: Learn how to build and manage cloud-native applications using KubeSphere Container Platform. Get documentation, example code, tutorials, and more.
image: /images/docs/common/banner.png
+ version: v4.1
sectionLink:
docs:
diff --git a/content/zh/docs/v4.1/_index.adoc b/content/zh/docs/v4.1/_index.adoc
index 2d815e353..0839a618f 100644
--- a/content/zh/docs/v4.1/_index.adoc
+++ b/content/zh/docs/v4.1/_index.adoc
@@ -8,6 +8,7 @@ section1:
title: KubeSphere
content: 了解如何通过 KubeSphere 构建并管理云原生应用程序。获取文档、示例代码与教程等信息。
image: /images/docs/common/banner.png
+ version: v4.1
sectionLink:
docs:
diff --git a/layouts/docs/list.html b/layouts/docs/list.html
index 65e89a98c..3f14d5661 100644
--- a/layouts/docs/list.html
+++ b/layouts/docs/list.html
@@ -50,7 +50,7 @@
- {{ partial "section" . }}
+ {{ partial "section" (dict "context" .) }}
diff --git a/layouts/docs/second.html b/layouts/docs/second.html
index e5b3f1d84..0ca39d01a 100644
--- a/layouts/docs/second.html
+++ b/layouts/docs/second.html
@@ -40,10 +40,13 @@ height="0" width="0" style="display:none;visibility:hidden">
+ {{ $version := index (strings.FindRE `v[0-9]+\.[0-9]+` .Page.RelPermalink) 0}}
+
+
diff --git a/layouts/docs/single.html b/layouts/docs/single.html
index 4638628bf..e974bcdf6 100644
--- a/layouts/docs/single.html
+++ b/layouts/docs/single.html
@@ -41,10 +41,13 @@
+ {{ $version := index (strings.FindRE `v[0-9]+\.[0-9]+` .Page.RelPermalink) 0}}
+
+
diff --git a/layouts/partials/section.html b/layouts/partials/section.html
index e8a5cb865..b7b052001 100644
--- a/layouts/partials/section.html
+++ b/layouts/partials/section.html
@@ -1,41 +1,22 @@
-{{ $sections := .Sections.ByWeight }}
- {{ range $sections }}
- -
-
-
- {{ .LinkTitle }}
-
- {{ $page_list := (union (where .Pages ".Params._build.render" "!=" false) .Sections).ByWeight }}
- {{ $length := len $page_list}}
-
+ {{ if .ver }}
+ {{ $sections := where .context.Sections ".Params.section1.version" "==" .ver }}
- {{ if gt $length 6 }}
- {{ range first 5 $page_list }}
- -
- {{ if .IsPage }}
- {{ .LinkTitle }}
- {{ else }}
- {{ partial "firstPageInSection" (dict "section" . "firstSection" .) }}
- {{ end }}
-
- {{ end }}
- - {{ i18n "Learn More" }}...
- {{ else }}
- {{ range first 6 $page_list }}
- -
- {{ if .IsPage }}
- {{ .LinkTitle }}
- {{ else }}
- {{ partial "firstPageInSection" (dict "section" . "firstSection" .) }}
- {{ end }}
-
- {{ end }}
- {{ end }}
-
-
+ {{ range $sections }}
+ {{ partial "section_item" . }}
{{ end }}
{{ range $sections }}
{{ end }}
+
+
+ {{ else }}
+ {{ $sections := .context.Sections.ByWeight }}
+ {{ range $sections }}
+ {{ partial "section_item" . }}
+ {{ end }}
+ {{ range $sections }}
+
+ {{ end }}
+ {{ end }}
\ No newline at end of file
diff --git a/layouts/partials/section_item.html b/layouts/partials/section_item.html
new file mode 100644
index 000000000..df41e333a
--- /dev/null
+++ b/layouts/partials/section_item.html
@@ -0,0 +1,32 @@
+
+
+
+ {{ .LinkTitle }}
+
+ {{ $page_list := (union (where .Pages ".Params._build.render" "!=" false) .Sections).ByWeight }}
+ {{ $length := len $page_list}}
+
+ {{ if gt $length 6 }}
+ {{ range first 5 $page_list }}
+ -
+ {{ if .IsPage }}
+ {{ .LinkTitle }}
+ {{ else }}
+ {{ partial "firstPageInSection" (dict "section" . "firstSection" .) }}
+ {{ end }}
+
+ {{ end }}
+ - {{ i18n "Learn More" }}...
+ {{ else }}
+ {{ range first 6 $page_list }}
+ -
+ {{ if .IsPage }}
+ {{ .LinkTitle }}
+ {{ else }}
+ {{ partial "firstPageInSection" (dict "section" . "firstSection" .) }}
+ {{ end }}
+
+ {{ end }}
+ {{ end }}
+
+
\ No newline at end of file