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..b4914e049 100644 --- a/layouts/docs/second.html +++ b/layouts/docs/second.html @@ -1,332 +1,341 @@ + {{- partial "head.html" . -}} -{{ if .Site.Params.addGoogleTag }} - - - -{{ end }} -{{- partial "header.html" . -}} -
-
-
- {{ partial "breadcrumb.html" . }} - -
- {{ $sections := .FirstSection.Sections.ByWeight }} - {{ $secondSection := .FirstSection }} - {{ $page := . }} - {{ range $sections }} + {{ if .Site.Params.addGoogleTag }} + + + + {{ end }} + {{- partial "header.html" . -}} +
+
+
+ {{ partial "breadcrumb.html" . }} + +
+ {{ $sections := .FirstSection.Sections.ByWeight }} + {{ $secondSection := .FirstSection }} + {{ $page := . }} + {{ range $sections }} {{ if $page.IsDescendant . }} - {{ $secondSection = . }} + {{ $secondSection = . }} {{ end }} - {{ end }} -

{{ $secondSection.LinkTitle }}

- + +
+ {{ partial "searchInput" . }}
- -
- {{ partial "searchInput" . }} +
+ + {{ $version := index (strings.FindRE `v[0-9]+\.[0-9]+` .Page.RelPermalink) 0}} + + +
+ {{ with (.GetPage "/docs" ) }} +
+ {{ partial "section" (dict "context" . "ver" $version) }}
-
-
- -
- {{ with (.GetPage "/docs") }} -
- {{ partial "section" . }} -
- {{ end }} -
- -
-
-
-
- {{ partial "tree.html" . }} - -
-
-
-
-
-
-
-
-
-
- {{ i18n "Last updated" }}: - - -
    -
    -
    -
    - +
    +
    +
    +
    +
    +
    +
    + - - - {{ define "content" }} - {{ if .context.IsSection }} - {{ .context.LinkTitle }} - {{ else }} - {{ .context.LinkTitle }} - {{ end }} -

    {{ .context.Description }}

    - {{ $count := add .count 1 }} - {{ if .context.IsSection }} - {{ range (union (where .context.Pages ".context.Params._build.render" "!=" false) .context.Sections).ByWeight }} + {{ define "content" }} + {{ if .context.IsSection }} + {{ .context.LinkTitle }} + {{ else }} + {{ .context.LinkTitle }} + {{ end }} +

    {{ .context.Description }}

    + {{ $count := add .count 1 }} + {{ if .context.IsSection }} + {{ range (union (where .context.Pages ".context.Params._build.render" "!=" false) + .context.Sections).ByWeight }} {{ template "content" (dict "context" . "count" $count) }} - {{ end }} - {{ else}} - {{ end }} - {{ end }} - -
    -
    -

    {{ .Title }}

    - {{ .Content }} - {{ range (union (where .Pages ".Params._build.render" "!=" false) .Sections).ByWeight }} - {{ template "content" (dict "context" . "count" 2) }} - {{ end }} + {{ end }} + {{ else}} + {{ end }} + {{ end }} + +
    +
    +

    {{ .Title }}

    + {{ .Content }} + {{ range (union (where .Pages ".Params._build.render" "!=" false) .Sections).ByWeight }} + {{ template "content" (dict "context" . "count" 2) }} + {{ end }} +
    + + + + {{ if .IsPage }} + + {{ partial "pagination" . }} + + + {{ end }} + +
    {{ if .IsPage }} - -
    - {{ with .Next }} - - - {{ i18n - {{ i18n "Previous" }} - : {{.LinkTitle}} - - - {{ end }} - {{ with .Prev }} - - - - {{ end }} +
    +
    +
    + {{ i18n "What’s on this Page" }} +
    +
    + {{ .TableOfContents }} +
    +
    {{ end }} -
    - {{ if .IsPage }} -
    -
    -
    - {{ i18n "What’s on this Page" }} -
    -
    - {{ .TableOfContents }} -
    -
    -
    - {{ end }} -
    -
    - {{ $aside := resources.Get "js/aside.js" }} - {{ $asideJS := $aside | resources.Fingerprint "sha512" }} - - - {{ $tab := resources.Get "js/markdown-tab.js" }} - {{ $tabJS := $tab | resources.Fingerprint "sha512" }} - - - + + {{ $tab := resources.Get "js/markdown-tab.js" }} + {{ $tabJS := $tab | resources.Fingerprint "sha512" }} + + + -
    + var renderLatestTime = function (time) { + $('.update-time').html(time) + } - + + \ No newline at end of file diff --git a/layouts/docs/single.html b/layouts/docs/single.html index 4638628bf..1373408d5 100644 --- a/layouts/docs/single.html +++ b/layouts/docs/single.html @@ -41,10 +41,14 @@ + {{ $version := index (strings.FindRE `v[0-9]+\.[0-9]+` .Page.RelPermalink) 0}} + +
    + {{ with (.GetPage "/docs") }}
    - {{ partial "section" . }} + {{ partial "section" (dict "context" . "ver" $version) }}
    {{ end }}
    @@ -54,6 +58,7 @@
    {{ partial "tree.html" . }} + - - {{ i18n - {{ i18n "Previous" }} - : {{.LinkTitle}} - - - {{ end }} - {{ with .Prev }} - - - - {{ end }} -
    + + + + {{ if .IsPage }} + + {{ partial "pagination" . }} + {{ end }}
    +
    {{ if .IsPage }}
    @@ -334,7 +326,7 @@ __main() - $(".asciicast").children().attr( "title", "video" ); + $(".asciicast").children().attr("title", "video"); @@ -349,16 +341,20 @@
    - + - - - + + +

    {{ i18n "KubeSphere®️ 2023 All Rights Reserved." }}

    diff --git a/layouts/partials/findFirstInSection.html b/layouts/partials/findFirstInSection.html new file mode 100644 index 000000000..26834e793 --- /dev/null +++ b/layouts/partials/findFirstInSection.html @@ -0,0 +1,9 @@ +{{ if ne .Parent.CurrentSection .Parent.FirstSection }} +{{ with .}} + +{{ end }} +{{ end }} \ No newline at end of file diff --git a/layouts/partials/findLastInSection.html b/layouts/partials/findLastInSection.html new file mode 100644 index 000000000..65bad7447 --- /dev/null +++ b/layouts/partials/findLastInSection.html @@ -0,0 +1,23 @@ + +{{ if ne .Parent.CurrentSection .Parent.FirstSection }} + +{{ if .IsSection}} +{{ $curSection := .Pages.ByWeight }} +{{ $l := len $curSection}} +{{ $page := index $curSection (sub $l 1)}} +{{ partial "findLastInSection" $page}} + +{{ else }} + + + + + {{ i18n + {{ i18n "Previous" }} + : {{.LinkTitle}} + +{{ end }} + +{{ end }} \ No newline at end of file diff --git a/layouts/partials/page_navigate.html b/layouts/partials/page_navigate.html new file mode 100644 index 000000000..e8da4271b --- /dev/null +++ b/layouts/partials/page_navigate.html @@ -0,0 +1,195 @@ + +{{ $current := .context }} + + + +{{ if $current.IsPage}} +{{ $g_parent := $current.Parent.Parent }} + + + + +{{ $p_section := $g_parent.Pages.ByWeight }} +{{ $length := len $p_section }} + + +{{ if .prev }} +{{ $first := index $p_section 0}} + + + + +{{ if $current.InSection $first.CurrentSection }} + + + + +{{ partial "page_navigate" (dict "context" $g_parent "prev" true)}} + + +{{else}} + + + +{{ $curIndex := 0 }} +{{ range $i, $p_sec := $p_section}} + +{{ if eq $p_sec $current.CurrentSection}} +{{ $curIndex = $i }} +{{ end }} +{{ end }} + + +{{ $prevPage := index $p_section (sub $curIndex 1) }} +{{ partial "findLastInSection" $prevPage}} + +{{ end }} + + + +{{ else }} + +{{ $last := index $p_section (sub $length 1)}} + + + +{{ if $current.InSection $last.CurrentSection }} + + + +{{ partial "page_navigate" (dict "context" $g_parent "prev" false)}} + + +{{ else }} + + +{{ $curIndex := 0 }} +{{ range $i, $p_sec := $p_section}} + +{{ if eq $p_sec $current.CurrentSection}} +{{ $curIndex = $i }} +{{ end }} +{{ end }} + + +{{ $nextPage := index $p_section (add $curIndex 1) }} +{{ partial "findFirstInSection" $nextPage}} + +{{ end }} + +{{ end }} + + + + +{{ else }} +{{ $g_parent := $current.Parent}} + +{{ $p_section := $g_parent.Pages.ByWeight }} +{{ $length := len $p_section }} + + +{{ if .prev}} +{{ $first := index $p_section 0}} + + + +{{ if $current.InSection $first.CurrentSection }} + +{{ partial "page_navigate" (dict "context" $g_parent "prev" true)}} + + +{{ else }} +{{ $curIndex := 0 }} +{{ range $i, $p_sec := $p_section}} + +{{ if eq $p_sec $current.CurrentSection}} +{{ $curIndex = $i }} +{{ end }} +{{ end }} + + +{{ $prevPage := index $p_section (sub $curIndex 1) }} +{{ partial "findLastInSection" $prevPage}} + +{{ end }} + + + +{{ else }} + +{{ $last := index $p_section (sub $length 1)}} + + + +{{ if $current.InSection $last.CurrentSection }} + + +{{ partial "page_navigate" (dict "context" $g_parent "prev" false)}} + + +{{ else }} + + +{{ $curIndex := 0 }} +{{ range $i, $p_sec := $p_section}} + +{{ if eq $p_sec $current.CurrentSection}} +{{ $curIndex = $i }} +{{ end }} +{{ end }} + + +{{ $nextPage := index $p_section (add $curIndex 1) }} +{{ partial "findFirstInSection" $nextPage}} + +{{ end }} + +{{ end }} + +{{ end }} \ No newline at end of file diff --git a/layouts/partials/pagination.html b/layouts/partials/pagination.html new file mode 100644 index 000000000..7c5c616b8 --- /dev/null +++ b/layouts/partials/pagination.html @@ -0,0 +1,45 @@ + + +
    + + {{ $current := .}} + {{ $p := .Parent.Pages.ByWeight }} + {{ $length := len $p }} + + + + {{ $curIndex := 0 }} + {{ range $i, $p_sec := $p}} + + + + {{ if eq $p_sec $current}} + {{ $curIndex = $i }} + {{ end }} + {{ end }} + + + + + {{ if gt $curIndex 0}} + {{ $prevPage := index $p (sub $curIndex 1) }} + {{ partial "findLastInSection" $prevPage}} + {{ else }} + {{ partial "page_navigate" (dict "context" . "prev" true)}} + {{ end }} + + + + {{ if lt $curIndex (sub $length 1) }} + {{ $nextPage := index $p (add $curIndex 1)}} + {{ partial "findFirstInSection" $nextPage}} + {{ else }} + {{ partial "page_navigate" (dict "context" . "prev" false)}} + {{ end }} + +
    \ No newline at end of file diff --git a/layouts/partials/section.html b/layouts/partials/section.html index e8a5cb865..7f79c5d10 100644 --- a/layouts/partials/section.html +++ b/layouts/partials/section.html @@ -1,41 +1,23 @@ -{{ $sections := .Sections.ByWeight }} \ 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..9296fa421 --- /dev/null +++ b/layouts/partials/section_item.html @@ -0,0 +1,33 @@ +
  • +

    + {{ .LinkTitle }} + {{ .LinkTitle }} +

    + {{ $page_list := (union (where .Pages ".Params._build.render" "!=" false) .Sections).ByWeight }} + {{ $length := len $page_list}} + +
  • \ No newline at end of file diff --git a/layouts/partials/tree.html b/layouts/partials/tree.html index f0084095b..3d1655d44 100644 --- a/layouts/partials/tree.html +++ b/layouts/partials/tree.html @@ -1,22 +1,29 @@ + + + +
    -
    + + {{ define "section-tree-nav-section" }} {{ $s := .section }} {{ $p := .page }} {{ $list_active := $p.IsDescendant $s }} -{{ if eq $s.Parent $s.FirstSection }} + +{{ if eq $s.Parent $s.FirstSection }} {{ else }}

    @@ -25,7 +32,21 @@ {{ end }}

    {{ end }} + \ No newline at end of file