尝试修复上下页跳转混乱和 hover 文档错误

Signed-off-by: ROOMrepair <twekjz@gmail.com>
This commit is contained in:
ROOMrepair 2024-10-30 18:04:26 +08:00
parent aff11aa3f0
commit 701c81afce
12 changed files with 681 additions and 366 deletions

View File

@ -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:

View File

@ -8,6 +8,7 @@ section1:
title: KubeSphere
content: 了解如何通过 KubeSphere 构建并管理云原生应用程序。获取文档、示例代码与教程等信息。
image: /images/docs/common/banner.png
version: v4.1
sectionLink:
docs:

View File

@ -50,7 +50,7 @@
<section class="section-2">
<div class="common-layout">
{{ partial "section" . }}
{{ partial "section" (dict "context" .) }}
</div>
</section>

View File

@ -1,332 +1,341 @@
<!DOCTYPE html>
<html lang="{{ with .Site.LanguageCode }}{{ . }}{{ else }}en-US{{ end }}">
<head>
{{- partial "head.html" . -}}
</head>
<body>
{{ if .Site.Params.addGoogleTag }}
<!-- Google Tag Manager (noscript) -->
<noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-W9FLX4R"
height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
<!-- End Google Tag Manager (noscript) -->
{{ end }}
{{- partial "header.html" . -}}
<main class='main-section padding'>
<section class='section-1 bg-cover'>
<div class="common-layout">
{{ partial "breadcrumb.html" . }}
<div class="title-div">
{{ $sections := .FirstSection.Sections.ByWeight }}
{{ $secondSection := .FirstSection }}
{{ $page := . }}
{{ range $sections }}
{{ if .Site.Params.addGoogleTag }}
<!-- Google Tag Manager (noscript) -->
<noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-W9FLX4R" height="0" width="0"
style="display:none;visibility:hidden"></iframe></noscript>
<!-- End Google Tag Manager (noscript) -->
{{ end }}
{{- partial "header.html" . -}}
<main class='main-section padding'>
<section class='section-1 bg-cover'>
<div class="common-layout">
{{ partial "breadcrumb.html" . }}
<div class="title-div">
{{ $sections := .FirstSection.Sections.ByWeight }}
{{ $secondSection := .FirstSection }}
{{ $page := . }}
{{ range $sections }}
{{ if $page.IsDescendant . }}
{{ $secondSection = . }}
{{ $secondSection = . }}
{{ end }}
{{ end }}
<p><a href="{{ $secondSection.RelPermalink }}">{{ $secondSection.LinkTitle }}</a></p>
<div class="menu section-control">
<div></div>
<div></div>
<div></div>
{{ end }}
<p><a href="{{ $secondSection.RelPermalink }}">{{ $secondSection.LinkTitle }}</a></p>
<div class="menu section-control">
<div></div>
<div></div>
<div></div>
</div>
</div>
<div class="search-div">
{{ partial "searchInput" . }}
</div>
</div>
<div class="search-div">
{{ partial "searchInput" . }}
</section>
{{ $version := index (strings.FindRE `v[0-9]+\.[0-9]+` .Page.RelPermalink) 0}}
<!-- {{ $doc_version := printf "/docs/%s" $version }} -->
<section class="section-menu">
{{ with (.GetPage "/docs" ) }}
<div class="common-layout">
{{ partial "section" (dict "context" . "ver" $version) }}
</div>
</div>
</section>
<section class="section-menu">
{{ with (.GetPage "/docs") }}
<div class="common-layout">
{{ partial "section" . }}
</div>
{{ end }}
</section>
<section class="section-2">
<div class="common-layout">
<div class="left-div left-tree">
<div class="inner-tree">
{{ partial "tree.html" . }}
<!-- <div class="download-div">
{{ end }}
</section>
<section class="section-2">
<div class="common-layout">
<div class="left-div left-tree">
<div class="inner-tree">
{{ partial "tree.html" . }}
<!-- <div class="download-div">
<span class="download-icon"></span>
<span>{{ i18n "Download this page (PDF)" }}</span>
</div> -->
</div>
</div>
<div class="second-section-menu">
<div></div>
<div></div>
<div></div>
</div>
<div class="middle-div">
<div class="top-div common-flex-layout">
<div class="contributor-div">
<span>{{ i18n "Last updated" }}:</span>
<span class="update-time"></span>
<a href="{{ .Site.Params.githubBlobUrl }}/{{ .Site.Language.Lang }}/{{ .File.Path }}" target="_blank" rel="noopener noreferrer">
<ul class="contributor-avatar"></ul>
</a>
<span class="more-contributor"></span>
</div>
<div class="mutual-div common-flex-layout">
<div class="edit-div">
<a href="{{ .Site.Params.githubEditUrl }}/{{ .Site.Language.Lang }}/{{ .File.Path }}" target="_blank" rel="noopener noreferrer">
<span class="icon-span"></span>
<span>{{ i18n "edit" }}</span>
</div>
<div class="second-section-menu">
<div></div>
<div></div>
<div></div>
</div>
<div class="middle-div">
<div class="top-div common-flex-layout">
<div class="contributor-div">
<span>{{ i18n "Last updated" }}:</span>
<span class="update-time"></span>
<a href="{{ .Site.Params.githubBlobUrl }}/{{ .Site.Language.Lang }}/{{ .File.Path }}"
target="_blank" rel="noopener noreferrer">
<ul class="contributor-avatar"></ul>
</a>
<span class="more-contributor"></span>
</div>
<div class="feedback-div">
<a href="{{ .Site.Params.githubUrl }}/issues/new" target="_blank" rel="noopener noreferrer">
<span class="icon-span"></span>
<span>{{ i18n "feedback" }}</span>
</a>
</div>
<div class="share-div">
<div>
<span class="icon-span"></span>
<span>{{ i18n "share" }}</span>
<div class="mutual-div common-flex-layout">
<div class="edit-div">
<a href="{{ .Site.Params.githubEditUrl }}/{{ .Site.Language.Lang }}/{{ .File.Path }}"
target="_blank" rel="noopener noreferrer">
<span class="icon-span"></span>
<span>{{ i18n "edit" }}</span>
</a>
</div>
<div class="feedback-div">
<a href="{{ .Site.Params.githubUrl }}/issues/new" target="_blank"
rel="noopener noreferrer">
<span class="icon-span"></span>
<span>{{ i18n "feedback" }}</span>
</a>
</div>
<div class="share-div">
<div>
<span class="icon-span"></span>
<span>{{ i18n "share" }}</span>
</div>
<ul>
<li>
<img src="/images/docs/v3.3/twitter.svg" alt="twitter">
<a href="https://twitter.com/intent/tweet?url={{ .Permalink }}&text={{ .Title }}"
target="_blank" rel="noopener noreferrer">twitter</a>
</li>
<li>
<img src="/images/docs/v3.3/linkedIn.svg" alt="linkedIn">
<a href="https://www.linkedin.com/shareArticle?mini=true&url={{ .Permalink }}"
target="_blank" rel="noopener noreferrer">linkedIn</a>
</li>
<li>
<img src="/images/docs/v3.3/facebook.svg" alt="facebook">
<a href="https://www.facebook.com/sharer.php?u={{ .Permalink }}" target="_blank"
rel="noopener noreferrer">facebook</a>
</li>
<li>
<img src="/images/docs/v3.3/reddit.svg" alt="reddit">
<a href="https://reddit.com/submit?url={{ .Permalink }}&title={{ .Title }}"
target="_blank" rel="noopener noreferrer">reddit</a>
</li>
<li>
<img src="/images/docs/v3.3/email.svg" alt="email">
<a href="mailto:info@kubesphere.io" target="_blank"
rel="noopener noreferrer">email</a>
</li>
</ul>
</div>
<ul>
<li>
<img src="/images/docs/v3.3/twitter.svg" alt="twitter">
<a href="https://twitter.com/intent/tweet?url={{ .Permalink }}&text={{ .Title }}" target="_blank" rel="noopener noreferrer">twitter</a>
</li>
<li>
<img src="/images/docs/v3.3/linkedIn.svg" alt="linkedIn">
<a href="https://www.linkedin.com/shareArticle?mini=true&url={{ .Permalink }}" target="_blank" rel="noopener noreferrer">linkedIn</a>
</li>
<li>
<img src="/images/docs/v3.3/facebook.svg" alt="facebook">
<a href="https://www.facebook.com/sharer.php?u={{ .Permalink }}" target="_blank" rel="noopener noreferrer">facebook</a>
</li>
<li>
<img src="/images/docs/v3.3/reddit.svg" alt="reddit">
<a href="https://reddit.com/submit?url={{ .Permalink }}&title={{ .Title }}" target="_blank" rel="noopener noreferrer">reddit</a>
</li>
<li>
<img src="/images/docs/v3.3/email.svg" alt="email" >
<a href="mailto:info@kubesphere.io" target="_blank" rel="noopener noreferrer">email</a>
</li>
</ul>
</div>
</div>
</div>
{{ define "content" }}
{{ if .context.IsSection }}
<h{{.count}}>{{ .context.LinkTitle }}</h{{.count}}>
{{ else }}
<h{{.count}}><a href="{{ .context.RelPermalink }}">{{ .context.LinkTitle }}</a></h{{.count}}>
{{ end }}
<p>{{ .context.Description }}</p>
{{ $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 }}
<h{{.count}}>{{ .context.LinkTitle }}</h{{.count}}>
{{ else }}
<h{{.count}}><a href="{{ .context.RelPermalink }}">{{ .context.LinkTitle }}</a></h{{.count}}>
{{ end }}
<p>{{ .context.Description }}</p>
{{ $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 }}
<div class="content-div main-div">
<div class="md-body">
<h1>{{ .Title }}</h1>
{{ .Content }}
{{ range (union (where .Pages ".Params._build.render" "!=" false) .Sections).ByWeight }}
{{ template "content" (dict "context" . "count" 2) }}
{{ end }}
{{ end }}
{{ else}}
{{ end }}
{{ end }}
<div class="content-div main-div">
<div class="md-body">
<h1>{{ .Title }}</h1>
{{ .Content }}
{{ range (union (where .Pages ".Params._build.render" "!=" false) .Sections).ByWeight }}
{{ template "content" (dict "context" . "count" 2) }}
{{ end }}
</div>
</div>
<!-- DEBUG {{ partial "page_navigate" (dict "context" . "prev" true)}} -->
{{ if .IsPage }}
<!-- <div class="page-div common-flex-layout"> -->
{{ partial "pagination" . }}
<!-- </div> -->
{{ end }}
<div></div>
</div>
{{ if .IsPage }}
<div class="page-div common-flex-layout">
{{ with .Next }}
<!-- {{ if .IsDescendant (.GetPage "/docs")}} -->
<a class="last" href="{{.RelPermalink}}">
<img src="/images/docs/v3.3/last.svg" alt="{{ i18n "Previous" }}">
{{ i18n "Previous" }}
<span>: {{.LinkTitle}}</span>
</a>
<!-- {{ end }} -->
{{ end }}
{{ with .Prev }}
<!-- {{ if .IsDescendant (.GetPage "/docs")}} -->
<a class="next" href="{{.RelPermalink}}">
{{ i18n "Next" }}
<span>: {{.LinkTitle}}</span>
<img src="/images/docs/v3.3/next.svg" alt="{{ i18n "Next" }}">
</a>
<!-- {{ end }} -->
{{ end }}
<div class="aside">
<div class="inner-div">
<div class='title'>
{{ i18n "Whats on this Page" }}
</div>
<div class='tabs'>
{{ .TableOfContents }}
</div>
</div>
</div>
{{ end }}
<div></div>
</div>
{{ if .IsPage }}
<div class="aside">
<div class="inner-div">
<div class='title'>
{{ i18n "Whats on this Page" }}
</div>
<div class='tabs'>
{{ .TableOfContents }}
</div>
</div>
</div>
{{ end }}
</div>
</section>
{{ $aside := resources.Get "js/aside.js" }}
{{ $asideJS := $aside | resources.Fingerprint "sha512" }}
<script type="text/javascript" src="{{ $asideJS.RelPermalink }}" integrity="{{ $asideJS.Data.Integrity }}"></script>
{{ $tab := resources.Get "js/markdown-tab.js" }}
{{ $tabJS := $tab | resources.Fingerprint "sha512" }}
<script type="text/javascript" src="{{ $tabJS.RelPermalink }}" integrity="{{ $tabJS.Data.Integrity }}"></script>
<script>
var languageCode = '{{.Site.Language.Lang}}'
var filePath = '{{ .File.Path }}'
var githubUrl = '{{ .Site.Params.githubUrl }}'
// var filePath = 'README.md'
var getLatestTime = function(data) {
var commit = data[0].commit
return commit.author.date.replace("T", " ").replace("Z", "")
}
var filterData = function(data) {
var arr = []
var length = data.length
for (var i = 0; i < length; i++) {
var author = data[i].author
if (author) {
var avatar_url = author.avatar_url
if (avatar_url && !arr.includes(avatar_url)) {
arr.push(avatar_url)
</section>
{{ $aside := resources.Get "js/aside.js" }}
{{ $asideJS := $aside | resources.Fingerprint "sha512" }}
<script type="text/javascript" src="{{ $asideJS.RelPermalink }}"
integrity="{{ $asideJS.Data.Integrity }}"></script>
{{ $tab := resources.Get "js/markdown-tab.js" }}
{{ $tabJS := $tab | resources.Fingerprint "sha512" }}
<script type="text/javascript" src="{{ $tabJS.RelPermalink }}" integrity="{{ $tabJS.Data.Integrity }}"></script>
<script>
var languageCode = '{{.Site.Language.Lang}}'
var filePath = '{{ .File.Path }}'
var githubUrl = '{{ .Site.Params.githubUrl }}'
// var filePath = 'README.md'
var getLatestTime = function (data) {
var commit = data[0].commit
return commit.author.date.replace("T", " ").replace("Z", "")
}
var filterData = function (data) {
var arr = []
var length = data.length
for (var i = 0; i < length; i++) {
var author = data[i].author
if (author) {
var avatar_url = author.avatar_url
if (avatar_url && !arr.includes(avatar_url)) {
arr.push(avatar_url)
}
}
}
return arr
}
return arr
}
var getFileContributors = function() {
var url = 'https://api.github.com/repos/kubesphere/website/commits?path=content/' + languageCode + '/' + filePath
$.getJSON(url, function(data) {
if (!data || data.length === 0) {
$('.contributor-div').hide()
return
}
var newData = filterData(data)
var time = getLatestTime(data)
renderLatestTime(time)
renderContributors(newData)
})
}
var renderContributors = function(data) {
var contributor = $('.contributor-avatar')
var length = data.length
var len = 5
$.each(data.slice(0, len), function(index, item) {
var img = $("<img />", {
"src": item
var getFileContributors = function () {
var url = 'https://api.github.com/repos/kubesphere/website/commits?path=content/' + languageCode + '/' + filePath
$.getJSON(url, function (data) {
if (!data || data.length === 0) {
$('.contributor-div').hide()
return
}
var newData = filterData(data)
var time = getLatestTime(data)
renderLatestTime(time)
renderContributors(newData)
})
$("<li />", {
"html": img
}).appendTo(contributor);
});
var t = length - len
if (t > 0) {
$('.more-contributor').html('+' + t)
}
}
var renderLatestTime = function(time) {
$('.update-time').html(time)
}
var bindClickMenu = function() {
var sectionMenu = $(".section-menu")
$('.section-control').on('mouseenter', function(e){
if (sectionMenu.is(":hidden")) {
sectionMenu.show();
}
})
sectionMenu.on('mouseleave', function() {
sectionMenu.hide();
})
$(document).on("click", function(){
sectionMenu.hide()
});
sectionMenu.on("click", function(e){
e.stopPropagation();
})
}
var bindClickSecondMenu = function() {
var sectionMenu = $(".section-2 .left-div")
$('.second-section-menu').on('click', function(e){
sectionMenu.css("left", "0")
$(document).one("click", function(){
sectionMenu.css("left", "-274px")
var renderContributors = function (data) {
var contributor = $('.contributor-avatar')
var length = data.length
var len = 5
$.each(data.slice(0, len), function (index, item) {
var img = $("<img />", {
"src": item
})
$("<li />", {
"html": img
}).appendTo(contributor);
});
e.stopPropagation()
})
sectionMenu.on("click", function(e){
e.stopPropagation();
})
}
var useViewer = function() {
var viewer = new Viewer(document.querySelector('.md-body'), {
url: 'src'
})
}
var __main = function() {
getFileContributors()
bindClickMenu()
bindClickSecondMenu()
useViewer()
}
__main()
var t = length - len
if (t > 0) {
$('.more-contributor').html('+' + t)
}
}
</script>
</main>
var renderLatestTime = function (time) {
$('.update-time').html(time)
}
<footer>
<div class="down-main">
<div class='img-div'>
<a class='wechat' href="javascript:void(0);" aria-label="wechat">
{{ "/static/images/footer/wechat.svg" | readFile | safeHTML }}
<div class="hide-div">
<p>Follow the official account</p>
<img src="/images/footer/wechat_code.svg" alt="">
</div>
</a>
<a class='facebook-a' href="https://www.facebook.com/kubesphere" target="_blank" aria-label="facebook"></a>
<a class='twitter-a' href="{{ .Site.Params.twitterLink }}" target="_blank" rel="noopener noreferrer" aria-label="twitter"></a>
<a class='linkedin-a' href="{{ .Site.Params.linkedinLink }}" target="_blank" rel="noopener noreferrer" aria-label="linkedin"></a>
<a class='youtube-a' href="{{ .Site.Params.youtubeLink }}" target="_blank" rel="noopener noreferrer" aria-label="youtube"></a>
<a class='slack-a' href="{{ .Site.Params.slackLink }}" target="_blank" rel="noopener noreferrer" aria-label="slack"></a>
<a class='github-a' href="{{ .Site.Params.githubLink }}" target="_blank" rel="noopener noreferrer" aria-label="github"></a>
<a class='medium-a' href="{{ .Site.Params.mediumLink }}" target="_blank" rel="noopener noreferrer" aria-label="medium"></a>
var bindClickMenu = function () {
var sectionMenu = $(".section-menu")
$('.section-control').on('mouseenter', function (e) {
if (sectionMenu.is(":hidden")) {
sectionMenu.show();
}
})
sectionMenu.on('mouseleave', function () {
sectionMenu.hide();
})
$(document).on("click", function () {
sectionMenu.hide()
});
sectionMenu.on("click", function (e) {
e.stopPropagation();
})
}
var bindClickSecondMenu = function () {
var sectionMenu = $(".section-2 .left-div")
$('.second-section-menu').on('click', function (e) {
sectionMenu.css("left", "0")
$(document).one("click", function () {
sectionMenu.css("left", "-274px")
});
e.stopPropagation()
})
sectionMenu.on("click", function (e) {
e.stopPropagation();
})
}
var useViewer = function () {
var viewer = new Viewer(document.querySelector('.md-body'), {
url: 'src'
})
}
var __main = function () {
getFileContributors()
bindClickMenu()
bindClickSecondMenu()
useViewer()
}
__main()
</script>
</main>
<footer>
<div class="down-main">
<div class='img-div'>
<a class='wechat' href="javascript:void(0);" aria-label="wechat">
{{ "/static/images/footer/wechat.svg" | readFile | safeHTML }}
<div class="hide-div">
<p>Follow the official account</p>
<img src="/images/footer/wechat_code.svg" alt="">
</div>
</a>
<a class='facebook-a' href="https://www.facebook.com/kubesphere" target="_blank"
aria-label="facebook"></a>
<a class='twitter-a' href="{{ .Site.Params.twitterLink }}" target="_blank" rel="noopener noreferrer"
aria-label="twitter"></a>
<a class='linkedin-a' href="{{ .Site.Params.linkedinLink }}" target="_blank" rel="noopener noreferrer"
aria-label="linkedin"></a>
<a class='youtube-a' href="{{ .Site.Params.youtubeLink }}" target="_blank" rel="noopener noreferrer"
aria-label="youtube"></a>
<a class='slack-a' href="{{ .Site.Params.slackLink }}" target="_blank" rel="noopener noreferrer"
aria-label="slack"></a>
<a class='github-a' href="{{ .Site.Params.githubLink }}" target="_blank" rel="noopener noreferrer"
aria-label="github"></a>
<a class='medium-a' href="{{ .Site.Params.mediumLink }}" target="_blank" rel="noopener noreferrer"
aria-label="medium"></a>
</div>
<p class='p1'>{{ i18n "KubeSphere® 2023 All Rights Reserved." }}</p>
</div>
<p class='p1'>{{ i18n "KubeSphere® 2023 All Rights Reserved." }}</p>
</div>
</footer>
</footer>
</body>
</html>

View File

@ -41,10 +41,14 @@
</div>
</section>
{{ $version := index (strings.FindRE `v[0-9]+\.[0-9]+` .Page.RelPermalink) 0}}
<!-- {{ $doc_version := printf "/docs/%s" $version }} -->
<section class="section-menu">
{{ with (.GetPage "/docs") }}
<div class="common-layout">
{{ partial "section" . }}
{{ partial "section" (dict "context" . "ver" $version) }}
</div>
{{ end }}
</section>
@ -54,6 +58,7 @@
<div class="left-div left-tree">
<div class="inner-tree">
{{ partial "tree.html" . }}
<!-- <div class="download-div">
<span class="download-icon"></span>
<span>{{ i18n "Download this page (PDF)" }}</span>
@ -146,35 +151,22 @@
{{ partial "subscribe.html" .}}
</div>
</div>
<br>
<p class="msg-thank">{{ i18n "Msg-Thank" }}</p>
</div>
</div>
{{ if .IsPage }}
<div class="page-div common-flex-layout">
{{ with .Next }}
<!-- {{ if .IsDescendant (.GetPage "/docs")}} -->
<a class="last" href="{{.RelPermalink}}">
<img src="/images/docs/v3.3/last.svg" alt="{{ i18n " Previous" }}">
{{ i18n "Previous" }}
<span>: {{.LinkTitle}}</span>
</a>
<!-- {{ end }} -->
{{ end }}
{{ with .Prev }}
<!-- {{ if .IsDescendant (.GetPage "/docs")}} -->
<a class="next" href="{{.RelPermalink}}">
{{ i18n "Next" }}
<span>: {{.LinkTitle}}</span>
<img src="/images/docs/v3.3/next.svg" alt="{{ i18n " Next" }}">
</a>
<!-- {{ end }} -->
{{ end }}
</div>
<!-- DEBUG {{ partial "page_navigate" (dict "context" . "prev" true)}} -->
{{ if .IsPage }}
<!-- <div class="page-div common-flex-layout"> -->
{{ partial "pagination" . }}
<!-- </div> -->
{{ end }}
<div></div>
</div>
{{ if .IsPage }}
<div class="aside">
@ -334,7 +326,7 @@
__main()
$(".asciicast").children().attr( "title", "video" );
$(".asciicast").children().attr("title", "video");
</script>
</main>
@ -349,16 +341,20 @@
<img src="/images/footer/wechat_code.svg" alt="">
</div>
</a>
<a class='facebook-a' href="https://www.facebook.com/kubesphere" target="_blank" aria-label="facebook"></a>
<a class='facebook-a' href="https://www.facebook.com/kubesphere" target="_blank"
aria-label="facebook"></a>
<a class='twitter-a' href="{{ .Site.Params.twitterLink }}" target="_blank" aria-label="twitter"
rel="noopener noreferrer"></a>
<a class='linkedin-a' href="{{ .Site.Params.linkedinLink }}" target="_blank" aria-label="linkedin"
rel="noopener noreferrer"></a>
<a class='youtube-a' href="{{ .Site.Params.youtubeLink }}" target="_blank" aria-label="youtube"
rel="noopener noreferrer"></a>
<a class='slack-a' href="{{ .Site.Params.slackLink }}" target="_blank" aria-label="slack" rel="noopener noreferrer"></a>
<a class='github-a' href="{{ .Site.Params.githubLink }}" target="_blank" aria-label="github" rel="noopener noreferrer"></a>
<a class='medium-a' href="{{ .Site.Params.mediumLink }}" target="_blank" aria-label="medium" rel="noopener noreferrer"></a>
<a class='slack-a' href="{{ .Site.Params.slackLink }}" target="_blank" aria-label="slack"
rel="noopener noreferrer"></a>
<a class='github-a' href="{{ .Site.Params.githubLink }}" target="_blank" aria-label="github"
rel="noopener noreferrer"></a>
<a class='medium-a' href="{{ .Site.Params.mediumLink }}" target="_blank" aria-label="medium"
rel="noopener noreferrer"></a>
</div>
<p class='p1'>{{ i18n "KubeSphere® 2023 All Rights Reserved." }}</p>
</div>

View File

@ -0,0 +1,9 @@
{{ if ne .Parent.CurrentSection .Parent.FirstSection }} <!-- out of boundary -->
{{ with .}}
<a class="next" href="{{.RelPermalink}}">
{{ i18n "Next" }}
<span>: {{.LinkTitle}}</span>
<img src="/images/docs/v3.3/next.svg" alt="{{ i18n " Next" }}">
</a>
{{ end }}
{{ end }}

View File

@ -0,0 +1,23 @@
<!-- find last page in section -->
{{ if ne .Parent.CurrentSection .Parent.FirstSection }} <!-- out of boundary -->
{{ if .IsSection}} <!-- recursive -->
{{ $curSection := .Pages.ByWeight }}
{{ $l := len $curSection}}
{{ $page := index $curSection (sub $l 1)}}
{{ partial "findLastInSection" $page}}
{{ else }} <!-- not recursive -->
<!-- DEBUG <div style="position: relative ;z-index: 99;top:0;width: 100;height: 100;color: purple;">
target pre {{ . }}
</div> -->
<a class="last" href="{{.RelPermalink}}">
<img src="/images/docs/v3.3/last.svg" alt="{{ i18n " Previous" }}">
{{ i18n "Previous" }}
<span>: {{.LinkTitle}}</span>
</a>
{{ end }}
{{ end }}

View File

@ -0,0 +1,195 @@
<!-- !!! todo combine the logic of check ispage and isindex , too many duplicate codes !!! -->
{{ $current := .context }}
<!-- DEBUG <div style="position: relative ;z-index: 99;top:0;width: 100;height: 100;color: blue;">gcurrent {{ $current }}</div> -->
<!-- is page -->
{{ if $current.IsPage}}
{{ $g_parent := $current.Parent.Parent }}
<!-- DEBUG <div style="position: relative ;z-index: 99;top:0;width: 100;height: 100;color: blue;">
{{ $g_parent}}--{{$g_parent.FirstSection }}
{{ $g_parent.InSection $g_parent.FirstSection }}
</div> -->
<!-- important! here we need call .Pages to include both pure page and _index -->
{{ $p_section := $g_parent.Pages.ByWeight }}
{{ $length := len $p_section }}
<!-- page prev -->
{{ if .prev }}
{{ $first := index $p_section 0}}
<!-- DEBUG <div style="position: relative ;z-index: 99;top:0;width: 100;height: 100;color: red;">
first {{ $first }} <br>
first section {{ $first.CurrentSection }} <br>
current section {{ $current.CurrentSection }}
</div> -->
<!-- check if is already the first section (为第二级目录的第一个 section) -->
<!-- if is first section,we need to bottom up -->
{{ if $current.InSection $first.CurrentSection }}
<!--DEBUG <div style="position: relative ;z-index: 99;top:0;width: 100;height: 100;color: red;">
prev true
</div> -->
<!-- bottom up -->
{{ partial "page_navigate" (dict "context" $g_parent "prev" true)}}
<!--if not the first section just go to pre section last page (last page of pre section of p_section)-->
{{else}}
<!-- DEBUG <div style="position: relative ;z-index: 99;top:0;width: 100;height: 100;color: red;">
prev false
</div> -->
<!-- find current page's section position -->
{{ $curIndex := 0 }}
{{ range $i, $p_sec := $p_section}}
<!-- DEBUG <div style="position: relative ;z-index: 99;top:0;width: 100;height: 100;color: green;">
gparent_section {{ . }}
</div> -->
{{ if eq $p_sec $current.CurrentSection}}
{{ $curIndex = $i }}
{{ end }}
{{ end }}
<!-- DEBUG <div style="position: relative ;z-index: 99;top:0;width: 100;height: 100;color: pink;">
{{ $curIndex }}
</div> -->
{{ $prevPage := index $p_section (sub $curIndex 1) }}
{{ partial "findLastInSection" $prevPage}}
{{ end }} <!-- close of check page prev bottom up -->
<!-- page next -->
{{ else }}
{{ $last := index $p_section (sub $length 1)}}
<!--DEBUG <div style="position: relative ;z-index: 99;top:0;width: 100;height: 100;color: red;">
last {{ $last }} <br>
last section {{ $last.CurrentSection }} <br>
current section {{ $current.CurrentSection }}
</div> -->
<!-- if is last section,we need to bottom up -->
{{ if $current.InSection $last.CurrentSection }}
<!--DEBUG <div style="position: relative ;z-index: 99;top:0;width: 100;height: 100;color: red;">
next true
</div> -->
<!-- bottom up -->
{{ partial "page_navigate" (dict "context" $g_parent "prev" false)}}
<!--if not the last section just go to next section -->
{{ else }}
<!-- DEBUG <div style="position: relative ;z-index: 99;top:0;width: 100;height: 100;color: red;">
next false
</div> -->
{{ $curIndex := 0 }}
{{ range $i, $p_sec := $p_section}}
<!-- DEBUG <div style="position: relative ;z-index: 99;top:0;width: 100;height: 100;color: green;">
gparent_section {{ . }}
</div> -->
{{ if eq $p_sec $current.CurrentSection}}
{{ $curIndex = $i }}
{{ end }}
{{ end }}
<!--DEBUG <div style="position: relative ;z-index: 99;top:0;width: 100;height: 100;color: pink;">
{{ $curIndex }}
</div> -->
{{ $nextPage := index $p_section (add $curIndex 1) }}
{{ partial "findFirstInSection" $nextPage}}
{{ end }} <!-- close of check page next bottom up -->
{{ end }} <!-- close of page prev next-->
<!-------------------------------------------------------------------->
<!-- is Index -->
{{ else }}
{{ $g_parent := $current.Parent}}
{{ $p_section := $g_parent.Pages.ByWeight }}
{{ $length := len $p_section }}
<!-- index prev -->
{{ if .prev}}
{{ $first := index $p_section 0}}
<!--DEBUG <div style="position: relative ;z-index: 99;top:0;width: 100;height: 100;color: blue;">
{{ $g_parent}}--{{$g_parent.FirstSection }}
index {{ $g_parent.InSection $g_parent.FirstSection }} <br>
index first {{ $first}}
</div> -->
<!-- keep bottom up -->
{{ if $current.InSection $first.CurrentSection }}
<!-- DEBUG <div style="position: relative ;z-index: 99;top:0;width: 100;height: 100;color: red;">
index true
</div> -->
{{ partial "page_navigate" (dict "context" $g_parent "prev" true)}}
<!-- find current index's section position -->
{{ else }}
{{ $curIndex := 0 }}
{{ range $i, $p_sec := $p_section}}
<!-- DEBUG <div style="position: relative ;z-index: 99;top:0;width: 100;height: 100;color: green;">
gparent_section {{ . }}
</div> -->
{{ if eq $p_sec $current.CurrentSection}}
{{ $curIndex = $i }}
{{ end }}
{{ end }}
<!-- DEBUG <div style="position: relative ;z-index: 99;top:0;width: 100;height: 100;color: pink;">
{{ $curIndex }}
</div> -->
{{ $prevPage := index $p_section (sub $curIndex 1) }}
{{ partial "findLastInSection" $prevPage}}
{{ end }} <!-- close of check index prev bottom up -->
<!-- index next -->
{{ else }}
{{ $last := index $p_section (sub $length 1)}}
<!-- if is last section,we need to bottom up -->
{{ if $current.InSection $last.CurrentSection }}
<!-- DEBUG <div style="position: relative ;z-index: 99;top:0;width: 100;height: 100;color: red;">
next true
</div> -->
<!-- bottom up -->
{{ partial "page_navigate" (dict "context" $g_parent "prev" false)}}
<!--if not the last section just go to next section -->
{{ else }}
<!-- DEBUG <div style="position: relative ;z-index: 99;top:0;width: 100;height: 100;color: red;">
next false
</div> -->
{{ $curIndex := 0 }}
{{ range $i, $p_sec := $p_section}}
<!-- DEBUG <div style="position: relative ;z-index: 99;top:0;width: 100;height: 100;color: green;">
gparent_section {{ . }}
</div> -->
{{ if eq $p_sec $current.CurrentSection}}
{{ $curIndex = $i }}
{{ end }}
{{ end }}
<!-- DEBUG <div style="position: relative ;z-index: 99;top:0;width: 100;height: 100;color: pink;">
{{ $curIndex }}
</div> -->
{{ $nextPage := index $p_section (add $curIndex 1) }}
{{ partial "findFirstInSection" $nextPage}}
{{ end }} <!-- close of check index next bottom up -->
{{ end }} <!-- close of index prev next-->
{{ end }}

View File

@ -0,0 +1,45 @@
<!-- {{ partial "page_navigate" (dict "context" . "prev" false)}} -->
<div class="page-div common-flex-layout">
<!-- if not each page in a section is pure page we can't simply use prev/nextInsection -->
{{ $current := .}}
{{ $p := .Parent.Pages.ByWeight }}
{{ $length := len $p }}
<!-- find current page's section position -->
{{ $curIndex := 0 }}
{{ range $i, $p_sec := $p}}
<!-- DEBUG <div style="position: relative ;z-index: 99;top:0;width: 100;height: 100;color: darkblue;">
gparent_section {{ $p_sec }}
</div> -->
{{ if eq $p_sec $current}}
{{ $curIndex = $i }}
{{ end }}
{{ end }}
<!-- DEBUG <div style="position: relative ;z-index: 99;top:0;width: 100;height: 100;color: pink;">
cur {{ $current }}
{{ $curIndex }}
</div> -->
<!-- prev -->
{{ if gt $curIndex 0}}
{{ $prevPage := index $p (sub $curIndex 1) }}
{{ partial "findLastInSection" $prevPage}}
{{ else }}
{{ partial "page_navigate" (dict "context" . "prev" true)}}
{{ end }}
<!-- next -->
{{ if lt $curIndex (sub $length 1) }}
{{ $nextPage := index $p (add $curIndex 1)}}
{{ partial "findFirstInSection" $nextPage}}
{{ else }}
{{ partial "page_navigate" (dict "context" . "prev" false)}}
{{ end }}
</div>

View File

@ -1,41 +1,23 @@
{{ $sections := .Sections.ByWeight }}
<ul class="common-flex-layout">
{{ range $sections }}
<li>
<p>
<span><img src="{{ .Params.icon }}" alt="{{ .LinkTitle }}"></span>
<a href="{{ .RelPermalink }}">{{ .LinkTitle }}</a>
</p>
{{ $page_list := (union (where .Pages ".Params._build.render" "!=" false) .Sections).ByWeight }}
{{ $length := len $page_list}}
<ul>
{{ if .ver }}
{{ $sections := where .context.Sections ".Params.section1.version" "==" .ver }}
{{ if gt $length 6 }}
{{ range first 5 $page_list }}
<li>
{{ if .IsPage }}
<a href="{{ .RelPermalink }}" title="{{ .LinkTitle }}">{{ .LinkTitle }}</a>
{{ else }}
{{ partial "firstPageInSection" (dict "section" . "firstSection" .) }}
{{ end }}
</li>
{{ end }}
<li><a href="{{ .RelPermalink }}">{{ i18n "Learn More" }}...</a></li>
{{ else }}
{{ range first 6 $page_list }}
<li>
{{ if .IsPage }}
<a href="{{ .RelPermalink }}" title="{{ .LinkTitle }}">{{ .LinkTitle }}</a>
{{ else }}
{{ partial "firstPageInSection" (dict "section" . "firstSection" .) }}
{{ end }}
</li>
{{ end }}
{{ end }}
</ul>
</li>
{{ range $sections }}
{{ partial "section_item" . }}
{{ end }}
{{ range $sections }}
<li style="height: 0; margin: 0; padding: 0;"></li>
{{ end }}
<!-- render all -->
{{ else }}
{{ $sections := .context.Sections.ByWeight }}
{{ range $sections }}
{{ partial "section_item" . }}
{{ end }}
{{ range $sections }}
<li style="height: 0; margin: 0; padding: 0;"></li>
{{ end }}
{{ end }}
</ul>

View File

@ -0,0 +1,33 @@
<li>
<p>
<span><img src="{{ .Params.icon }}" alt="{{ .LinkTitle }}"></span>
<a href="{{ .RelPermalink }}">{{ .LinkTitle }}</a>
</p>
{{ $page_list := (union (where .Pages ".Params._build.render" "!=" false) .Sections).ByWeight }}
{{ $length := len $page_list}}
<ul>
{{ if gt $length 6 }}
{{ range first 5 $page_list }}
<li>
{{ if .IsPage }}
<a href="{{ .RelPermalink }}" title="{{ .LinkTitle }}">{{ .LinkTitle }}</a>
{{ else }}
{{ partial "firstPageInSection" (dict "section" . "firstSection" .) }}
{{ end }}
</li>
{{ end }}
<li><a href="{{ .RelPermalink }}">{{ i18n "Learn More" }}...</a></li>
{{ else }}
{{ range first 6 $page_list }}
<li>
{{ if .IsPage }}
<a href="{{ .RelPermalink }}" title="{{ .LinkTitle }}">{{ .LinkTitle }}</a>
{{ else }}
{{ partial "firstPageInSection" (dict "section" . "firstSection" .) }}
{{ end }}
</li>
{{ end }}
{{ end }}
</ul>
</li>

View File

@ -1,22 +1,29 @@
<!-- {{ $secs := .FirstSection.Sections.ByWeight }} -->
<!-- secs := v3.3 v3.4 v4.1-->
<!-- .FirstSection eg:/zh/docs -->
<div>
<nav class='nav-menu'>
<nav class='nav-menu'>
{{ $sections := .FirstSection.Sections.ByWeight }}
{{ $secondSection := .FirstSection }}
{{ $page := . }}
{{ range $sections }}
{{ if $page.IsDescendant . }}
{{ $secondSection = . }}
{{ end }}
{{ $page := . }} <!-- cur page -->
{{ range $sections }} <!-- v3.3 v3.4 v4.1 -->
{{ if $page.IsDescendant . }}
{{ $secondSection = . }}
{{ end }}
{{ template "section-tree-nav-section" (dict "page" . "section" $secondSection) }}
</nav>
{{ end }}
{{ template "section-tree-nav-section" (dict "page" . "section" $secondSection) }}
</nav>
</div>
{{ 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 }} <!-- don't show when we in vx.x _index page -->
{{ else }}
<p class="list-title">
<span class="arrow {{ if $list_active }}arrow-open{{ end }}"></span>
@ -25,7 +32,21 @@
{{ end }}
<ul class="{{ if $list_active }}ul-active{{ end }}">
<!-- here s.pages seems eq to s.section /vx.x/0x-.. ispage = false -->
{{ $pages := (union (where $s.Pages ".Params._build.render" "!=" false) $s.Sections).ByWeight }}
<!-- {{ range $s.Sections}}
<div style="position: relative ;z-index: 99;top:0;width: 100;height: 100;color: blue;">
{{.RelPermalink}}
</div>
{{ end }} -->
<!-- {{range $s.Pages }}
<div style="position: relative ;z-index: 99;top:0;width: 100;height: 100;color: red;">
{{ .RelPermalink }}
</div>
{{end}} -->
{{ range $pages }}
{{ $active := eq . $p }}
<li class="list{{ if $active }} active{{ end }}">
@ -39,8 +60,8 @@
</ul>
{{ end }}
<script>
$('.nav-menu .list-title').click(function() {
$('.nav-menu .list-title').click(function () {
$(this).find('.arrow').toggleClass('arrow-open')
$(this).next().toggleClass('ul-active')
})
</script>
</script>