Revise the Kubernetes website to use Docsy (#20874)

* Add Docsy, required packages and config

* Apply Docsy integration work to k8s website

This encompasses significant changes to the style system, layout files,
as well as changes to some of the static assets. To examine this work
and the iterations that were performed, the original repository can be
found at https://github.com/gearbox-built/kubernetes-hugo.git

* Address issues found in review

The styling and positioning of the header, footer, some shortcodes and
main container elements are improved. A new partial is added for
favicons. The sidebars, as well as inner table of contents, have been
altered for better positioning and rendering of content. Localization
has also been addressed.

* Enable announcements

The recent Black Lives Matter announcement surfaced issues which have
been addressed.
This commit is contained in:
Aidan Ranney
2020-06-15 12:09:57 -07:00
committed by GitHub
parent 49ac273969
commit 0625ced466
72 changed files with 4174 additions and 992 deletions
+18 -17
View File
@@ -1,9 +1,12 @@
<!DOCTYPE html>
<html id="{{ .Params.cid }}" lang="{{ .Language }}" class="{{ .Params.class }}">
<head>
{{ partial "head.html" . }}
</head>
<body class="page">
<!doctype html>
<html lang="{{ .Site.Language.Lang }}" class="{{.Params.class}} no-js">
<head>
{{ partial "head.html" . }}
</head>
<body class="td-{{ .Kind }}">
<header>
{{ partial "navbar.html" . }}
</header>
{{ block "announcement" . }}
{{ if .IsHome }}
{{ partial "frontpage-announcement.html" . }}
@@ -11,10 +14,9 @@
{{ partial "announcement.html" . }}
{{ end }}
{{ end }}
{{ partial "header.html" . }}
{{ block "hero" . }}
<!-- HERO -->
<section id="hero" class="light-text">
<section class="header-hero text-white pb-4 light-text">
<div class="main-section">
<div id="headlineWrapper">
<h1>{{ block "hero-title" . }}{{ .Params.bigheader | default .Title }}{{ end }}</h1>
@@ -31,13 +33,12 @@
{{ end }}
{{ end }}
{{ end }}
<main>
<article class="page-content">
{{ block "main" . }}{{ end }}
</article>
</main>
{{ partialCached "footer.html" . }}
{{ partialCached "footer-scripts.html" . }}
</body>
<div class="td-outer">
<main role="main" class="td-main">
{{ block "main" . }}{{ end }}
</main>
{{ partial "footer.html" . }}
</div>
{{ partialCached "scripts.html" . }}
</body>
</html>
-3
View File
@@ -1,3 +0,0 @@
{{ define "main" }}
{{ .Content }}
{{ end }}
-3
View File
@@ -1,3 +0,0 @@
{{ define "main" }}
{{ .Content }}
{{ end }}
+46 -42
View File
@@ -1,43 +1,47 @@
<!DOCTYPE html>
<html id="blog" lang="{{ .Language }}" class="gr__kubernetes_io fontawesome-i2svg-active fontawesome-i2svg-complete">
<head>
{{ partial "head.html" . }}
<link rel='stylesheet' type='text/css' href='https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css'>
<script defer src="https://use.fontawesome.com/releases/v5.0.6/js/all.js"></script>
<link rel="stylesheet" type="text/css" href="{{ "css/blog.css" | relURL }}">
</head>
<body>
{{ partial "announcement.html" . }}
{{ partial "header.html" . }}
<section id="hero" class="light-text no-sub">
<h1>{{ .Title }}</h1>
</section>
<main>
<div class="container-fluid" style="padding-top: 2em">
<div class="row">
<div class="col-xs-12 col-md-9 text blog-content">
{{ block "main" . }}{{ end }}
</div>
<div class="col-xs-12 col-md-3 text">
<div class="widget-content">
{{ with site.Home.OutputFormats.Get "rss" -}}
<link rel="{{ .Rel }}" type="{{ .MediaType.Type }}" href="{{ .Permalink | safeURL }}" title="{{ site.Title }}">
<a class="widget-link" href="{{ .Permalink | safeURL }}"><div> <i class="fas fa-rss fab-icon"> </i> <div class="widget-link-text">RSS Feed</div></div> </a>
{{ end -}}
<a class="widget-link" href="https://kubernetes.io/docs/contribute/start/#write-a-blog-post"><div> <i class="fa fa-edit fab-icon"></i> <div class="widget-link-text">Submit a Post</div></div></a>
<a class="widget-link" href="https://twitter.com/kubernetesio"><div> <i class="fab fa-twitter-square fab-icon"> </i> <div class="widget-link-text"> @Kubernetesio</div></div></a>
<a class="widget-link" href="https://github.com/kubernetes/kubernetes"><div> <i class="fab fa-github-square fab-icon"></i> <div class="widget-link-text"> on GitHub </div></div></a>
<a class="widget-link" href="http://slack.k8s.io"><div><i class="fab fa-slack fab-icon"> </i> <div class="widget-link-text">#kubernetes-users </div></div></a>
<a class="widget-link" href="https://stackoverflow.com/questions/tagged/kubernetes"><div><i class="fab fa-stack-overflow fab-icon"></i> <div class="widget-link-text"> Overflow</div></div></a>
<a class="widget-link" href="https://discuss.kubernetes.io"><div> <i class="fab fa-discourse fab-icon"></i><div class="widget-link-text"> Forum </div></div></a>
<a class="widget-link" href="https://kubernetes.io/docs/setup"><div><i class="fa fa-download fab-icon"></i> <div class="widget-link-text"> Kubernetes</div></div></a>
</div>
{{ partialCached "blog/archive.html" . }}
</div>
</div>
</div>
</main>
{{ partialCached "footer.html" . }}
{{ partialCached "footer-scripts.html" . }}
</body>
<!doctype html>
<html lang="{{ .Site.Language.Lang }}" class="no-js">
<head>
{{ partial "head.html" . }}
<title>{{ if .IsHome }}{{ .Site.Title }}{{ else }}{{ with .Title }}{{ . }} | {{ end }}{{ .Site.Title }}{{ end }}</title>
<script defer src="https://use.fontawesome.com/releases/v5.0.6/js/all.js"></script>
<!-- Disabled as Docsy is primarily handling styles for this template now -->
<!-- <link rel="stylesheet" type="text/css" href="{{ "css/blog.css" | relURL }}"> -->
</head>
<body class="td-{{ .Kind }} td-blog">
<header>
{{ partial "navbar.html" . }}
{{ partial "announcement.html" . }}
<section class="header-hero text-center text-white font-bold pb-4">
<h1>
{{ $sectionHeading := .Site.GetPage "section" .Section }}
{{ with $sectionHeading }}
{{ .Title }}
{{ end }}
</h1>
</section>
</header>
<div class="container-fluid td-outer">
<div class="td-main">
<div class="row flex-xl-nowrap">
<div class="col-12 col-md-3 col-xl-2 td-sidebar d-print-none">
{{ partial "blog-sidebar.html" . }}
</div>
<main class="col-12 col-md-9 col-xl-8 pl-md-5 pr-md-4" role="main">
{{ with .CurrentSection.OutputFormats.Get "rss" -}}
<a class="btn btn-lg -bg-orange td-rss-button d-none d-lg-block" href="{{ .Permalink | safeURL }}" target="_blank">
RSS <i class="fa fa-rss ml-2 "></i>
</a>
{{ end -}}
{{ block "main" . }}{{ end }}
</main>
<div class="d-none d-xl-block col-xl-2 td-toc d-print-none">
{{ partial "blog-meta-links.html" . }}
{{ partial "toc.html" . }}
</div>
</div>
</div>
{{ partial "footer.html" . }}
</div>
{{ partial "scripts.html" . }}
</body>
</html>
+39 -15
View File
@@ -1,17 +1,41 @@
{{ define "main" }}
{{ $pages := ($.Paginator 1).Pages }}
{{ with site.Params.language_alternatives }}
{{ range . }}
{{ with (where $.Translations ".Lang" . ) }}
{{ $p := index . 0 }}
{{ $pages = $pages | lang.Merge ($p.Paginator 1).Pages }}
{{ end }}
{{ end }}
{{ end }}
{{ range $pages }}
{{ .Render "post" }}
{{ end }}
<div class="PageNavigation">
{{ template "_internal/pagination.html" . }}
</div>
{{ if .Parent.IsHome }}
{{ $.Scratch.Set "blog-pages" (where .Site.RegularPages "Section" .Section) }}
{{ else }}
{{$.Scratch.Set "blog-pages" .Pages }}
{{ end }}
<!-- This file is identical to the Docsy template, except for a check to length before
calling Paginate. Kubernetes includes blog/index.html pages for languages which do not
have blog posts -->
{{ if gt (len ($.Scratch.Get "blog-pages")) 0 }}
{{ $pag := .Paginate (( $.Scratch.Get "blog-pages").GroupByDate "2006")}}
{{ $pageGroups := $pag.PageGroups}}
{{ if eq $pag.PageNumber 1 }}
{{ end }}
<div class="row">
<div class="col-12">
{{ range $pageGroups }}
<h2>{{ T "post_posts_in" }} {{ .Key }}</h2>
<ul class="list-unstyled mt-4">
{{ range .Pages }}
<li class="media mb-4">
<div class="media-body">
<h5 class="mt-0 mb-1"><a href="{{ .RelPermalink }}">{{ .LinkTitle }}</a></h5>
<p class="mb-2 mb-md-3"><small class="text-muted">{{ .Date.Format ($.Param "time_format_blog") }} {{ T "ui_in"}} {{ .CurrentSection.LinkTitle }}</small></p>
{{ partial "featured-image.html" (dict "p" . "w" 250 "h" 125 "class" "float-left mr-3 pt-1 d-none d-md-block") }}
<p class="pt-0 mt-0">{{ .Plain | safeHTML | truncate 250 }}</p>
<p class="pt-0"><a href="{{ .RelPermalink }}">{{ T "ui_read_more"}}</a></p>
</div>
</li>
{{ end }}
</ul>
{{ end }}
</div>
</div>
<div class="row pl-2 pt-2">
<div class="col">
{{ template "_internal/pagination.html" . }}
</div>
</div>
{{ end }}
{{ end }}
-12
View File
@@ -1,12 +0,0 @@
<div class="PageNavigation">
{{ if .PrevInSection }}
<div class="pagerButton left">
<h4><a class=" button" href="{{ .PrevInSection.RelPermalink }}"> {{ T "layouts_blog_pager_prev" }} </a></h4>
</div>
{{ end }}
{{ if .NextInSection }}
<div class="pagerButton right">
<h4><a class=" button" href="{{ .NextInSection.RelPermalink }}"> {{ T "layouts_blog_pager_next" }} </a></h4>
</div>
{{ end }}
</div>
-3
View File
@@ -1,3 +0,0 @@
<h4 class="date-header"><time datetime="{{ .Date.Format "2006-01-02" }}">{{ .Date.Format site.Params.time_format_blog }}</time></h4>
<h3 class="post-title entry-title"><a href="{{ .Permalink }}">{{ .Title }}</a></h3>
{{ .Content }}
-4
View File
@@ -1,4 +0,0 @@
{{ define "main" }}
{{ .Render "post" }}
{{ .Render "pager" }}
{{ end }}
+3 -2
View File
@@ -4,9 +4,10 @@
{{ partial "head.html" . }}
</head>
<body>
{{ partial "header.html" . }}
{{ partial "navbar.html" . }}
{{ block "main" . }}{{ end }}
{{ partialCached "footer.html" . }}
{{ partialCached "footer-scripts.html" . }}
<!-- Disabling this as elements queries do not appear to exist on case studies -->
<!-- {{ partialCached "footer-scripts.html" . }} -->
</body>
</html>
+45 -46
View File
@@ -1,48 +1,47 @@
<!DOCTYPE html>
<html id="docs" lang="{{ .Language }}" class="{{ .Params.class }}">
<head>
{{ partial "head.html" . }}
</head>
<body>
{{ partial "announcement.html" . }}
{{ partial "header.html" . }}
{{ block "hero" . }}
<!-- HERO -->
<section id="hero" class="light-text no-sub">
{{ partial "docs/top-menu.html" . }}
</section>
{{ end }}
{{ block "deprecation" . }}{{ partial "deprecation-warning.html" . }}{{ end }}
<main>
<section id="encyclopedia">
{{ block "side-menu" . }}<div id="docsToc" style="display:none;"></div>{{ end }}
<div id="{{ block "content-id" . }}docsContent{{ end }}">
{{ block "content" . }}{{ end }}
{{ partial "feedback.html" . }}
{{ partial "git-info.html" . }}
<!doctype html>
<html lang="{{ .Site.Language.Lang }}" class="no-js">
<head>
{{ partial "head.html" . }}
<title>{{ if .IsHome }}{{ .Site.Title }}{{ else }}{{ with .Title }}{{ . }} | {{ end }}{{ .Site.Title }}{{ end }}</title>
</head>
<body class="td-{{ .Kind }}">
<header>
{{ partial "navbar.html" . }}
{{ partial "announcement.html" . }}
<section class="header-hero text-center text-white font-bold pb-4">
<h1>
{{ $sectionHeading := .Site.GetPage "section" .Section }}
{{ with $sectionHeading }}
{{ .Title }}
{{ end }}
</h1>
</section>
</header>
<div class="container-fluid td-outer">
<div class="td-main">
<div class="row flex-md-nowrap">
<div class="col-12 col-md-3 col-xl-2 td-sidebar d-print-none">
{{ partial "sidebar.html" . }}
</div>
</section>
</main>
{{ partialCached "footer.html" . }}
{{ partialCached "footer-scripts.html" . }}
<script language="application/javascript">
// This script turns in-page headers into clickable and shareable
(function addHeadingLinks(){
var article = document.getElementById('docsContent');
var headings = article.querySelectorAll('h1, h2, h3, h4, h5, h6');
headings.forEach(function(heading){
if(heading.id){
var a = document.createElement('a');
a.innerHTML = heading.innerHTML;
a.href = '#'+heading.id;
a.classList.add('inpage_heading');
heading.innerHTML = '';
heading.appendChild(a);
}
});
})();
</script>
</body>
<main class="col-12 col-md-9 col-xl-8 pl-md-5" role="main">
{{ if not .Site.Params.ui.breadcrumb_disable }}{{ partial "breadcrumb.html" . }}{{ end }}
{{ block "main" . }}{{ end }}
{{ if (and (not .Params.hide_feedback) (.Site.Params.ui.feedback.enable) (.Site.GoogleAnalytics)) }}
{{ partial "feedback.html" .Site.Params.ui.feedback }}
{{ end }}
{{ partial "git-info.html" . }}
{{ if (.Site.DisqusShortname) }}
<br />
{{ partial "disqus-comment.html" . }}
{{ end }}
</main>
<div class="d-none d-xl-block col-xl-2 td-toc d-print-none">
{{ partial "toc.html" . }}
</div>
</div>
</div>
{{ partial "footer.html" . }}
</div>
{{ partial "scripts.html" . }}
</body>
</html>
+5 -32
View File
@@ -1,4 +1,4 @@
{{ define "content" }}
{{ define "main" }}
{{ if not .Params.notitle }}
<h1>{{ .Title }}</h1>
{{ end }}
@@ -13,37 +13,10 @@
<p>{{ .Params.overview | safeHTML }}</p>
<br>
<div class="launch-cards">
{{ template "docs-portal-card" . }}
{{ $page := (partial "docs/docs-portal-card" .) }}
{{ .Scratch.Set "html" $page }}
{{ $page }}
</div>
</div>
</section>
{{ end }}
{{ define "docs-portal-card" }}
{{ range .Params.cards }}
<div class="launch-card">
<h4>{{ .title }}</h4>
<p>{{ .description }}</p>
<br>
<ul>
{{ $name := .name }}
{{ range where ($.Site.Pages.ByParam "card.weight") ".Params.card" "!=" nil }}
{{ if eq .Params.card.name $name }}
{{ $p := . }}
{{ if (isset .Params.card "anchors") }}
{{ range .Params.card.anchors }}
<li><a href="{{ $p.Permalink }}{{ .anchor }}">{{ .title }}</a></li>
{{ end }}
{{ else }}
<li><a href={{ .Permalink }}>
{{ if (isset .Params.card "title") }}{{ .Params.card.title }}{{ else }}{{ .LinkTitle }}{{ end }}
</a></li>
{{ end }}
{{ end }}
{{ end }}
</ul>
<br><br>
<button id="btn-concepts" class="button" onClick="location.href='{{ .button_path | relLangURL }}';" aria-label="{{ .title }}">{{ .button }}</button>
</div>
{{ end }}
{{ end }}
{{ end }}
+2 -2
View File
@@ -2,7 +2,7 @@
{{ partial "docs/side-menu.html" . }}
{{ end }}
{{ define "content" }}
{{ define "main" }}
<h1>{{ .Title }}</h1>
<link href="{{ "css/glossary.css" | relURL }}" rel="stylesheet">
<script src="{{ "js/glossary.js" | relURL }}"></script>
@@ -43,7 +43,7 @@
<div>
<div class="term-name"><b>{{ .Title }}</b><a href="{{ printf "#%s" $term_identifier }}" class="permalink hide">LINK</a></div>
{{ with .Params.aka }}
{{ T "layouts_docs_glossary_aka" }}: <i>{{ delimit . ", " }}</i>
{{ T "layouts_docs_glossary_aka" }}:<i>{{ delimit . ", " }}</i>
<br>
{{ end }}
<span class="preview-text">{{ .Summary }} <a href="javascript:void(0)" class="click-controller no-underline" data-target="{{ .Params.id }}">[+]</a></span>
+16 -18
View File
@@ -1,19 +1,17 @@
{{ define "content" }}
{{ $hasContent := false }}
{{ with .File }}
{{ if ne .Filename "" }}
{{ $hasContent = (ge (len $.RawContent) 100) }}
{{ end }}
{{ end }}
{{ if $hasContent }}
{{ partial "docs/content-page" (dict "ctx" $ "page" $ ) }}
{{ else }}
{{ if ge (len .Pages) 1 }}
{{ $page := index .Pages 0 }}
{{ partial "docs/content-page" (dict "ctx" $ "page" $page) }}
{{ end }}
{{ end }}
{{ end }}
{{ define "side-menu" }}
{{ partial "docs/side-menu.html" . }}
{{ define "main" }}
<div class="td-content">
{{ with .Params.description }}<div class="lead">{{ . | markdownify }}</div>{{ end }}
{{ $hasContent := false }}
{{ with .File }}
{{ if ne .Filename "" }}
{{ $hasContent = (ge (len $.RawContent) 100) }}
{{ end }}
{{ end }}
{{ if $hasContent }}
{{ partial "docs/content-page" (dict "ctx" $ "page" $ ) }}
{{ else }}
<h1>{{ .Title }}</h1>
{{ end }}
{{ partial "section-index.html" . }}
</div>
{{ end }}
+25 -12
View File
@@ -1,14 +1,27 @@
{{ define "content" }}
<h1>{{ .Title }}</h1>
<gcse:searchresults-only linktarget="_parent">
<div id="bing-results-container">{{ T "layouts_docs_search_fetching" }}</div>
<div id="bing-pagination-container"></div>
</gcse:searchresults-only>
{{ define "main" }}
<section class="row td-search-result">
<div class="col-12 col-md-8 offset-md-2">
<h2 class="ml-4">{{ .Title }}</h2>
{{ if .Site.Params.gcs_engine_id }}
<script>
(function() {
var cx = '{{ . }}';
var gcse = document.createElement('script');
gcse.type = 'text/javascript';
gcse.async = true;
gcse.src = 'https://cse.google.com/cse.js?cx=' + cx;
var s = document.getElementsByTagName('script')[0];
s.parentNode.insertBefore(gcse, s);
})();
</script>
<gcse:searchresults-only></gcse:searchresults-only>
{{ else if .Site.Params.k8s_search }}
<script src="{{ "js/search.js" | relURL }}"></script>
<gcse:searchresults-only linktarget="_parent">
<div id="bing-results-container">{{ T "layouts_docs_search_fetching" }}</div>
<div id="bing-pagination-container"></div>
</gcse:searchresults-only>
{{ end }}
</div>
</section>
{{ end }}
+4 -8
View File
@@ -1,8 +1,4 @@
{{ define "content" }}
{{ partial "docs/content-page" (dict "ctx" . "page" .) }}
{{ end }}
{{ define "side-menu" }}
{{ partial "docs/side-menu.html" . }}
{{ end }}
{{ define "main" }}
<div class="td-content">
{{ partial "docs/content-page" (dict "ctx" . "page" .) }}
{{ end }}
+13
View File
@@ -0,0 +1,13 @@
<div class="td-page-blog-meta ml-2 pb-1 pt-2 mb-4">
{{ with site.Home.OutputFormats.Get "rss" -}}
<link rel="{{ .Rel }}" type="{{ .MediaType.Type }}" href="{{ .Permalink | safeURL }}" title="{{ site.Title }}">
<a class="widget-link" href="{{ .Permalink | safeURL }}"><div> <i class="fas fa-rss fab-icon"> </i> <span class="widget-link-text">RSS Feed</span></div> </a>
{{ end -}}
<a class="widget-link" href="https://kubernetes.io/docs/contribute/start/#write-a-blog-post"><div> <i class="fa fa-edit fab-icon"></i> <span class="widget-link-text">Submit a Post</span></div></a>
<a class="widget-link" href="https://twitter.com/kubernetesio"><div> <i class="fab fa-twitter-square fab-icon"> </i> <span class="widget-link-text"> @Kubernetesio</span></div></a>
<a class="widget-link" href="https://github.com/kubernetes/kubernetes"><div> <i class="fab fa-github-square fab-icon"></i> <span class="widget-link-text"> on GitHub </span></div></a>
<a class="widget-link" href="http://slack.k8s.io"><div><i class="fab fa-slack fab-icon"> </i> <span class="widget-link-text">#kubernetes-users </span></div></a>
<a class="widget-link" href="https://stackoverflow.com/questions/tagged/kubernetes"><div><i class="fab fa-stack-overflow fab-icon"></i> <span class="widget-link-text"> Overflow</span></div></a>
<a class="widget-link" href="https://discuss.kubernetes.io"><div> <i class="fab fa-discourse fab-icon"></i><span class="widget-link-text"> Forum </span></div></a>
<a class="widget-link" href="https://kubernetes.io/docs/setup"><div><i class="fa fa-download fab-icon"></i> <span class="widget-link-text"> Kubernetes</span></div></a>
</div>
+92
View File
@@ -0,0 +1,92 @@
{{/* The blog nav organizes posts grouped by year, which represents a customized version of the
sidebar-tree in use elsewhere on the site. */}}
{{/* We cache this partial for bigger sites and set the active class client side. */}}
{{ $shouldDelayActive := ge (len .Site.Pages) 2000 }}
<div id="td-sidebar-menu" class="td-sidebar__inner{{ if $shouldDelayActive }} d-none{{ end }}">
<nav class="collapse td-sidebar-nav pt-2 pl-4" id="td-section-nav">
<!-- {{ if (gt (len .Site.Home.Translations) 0) }}
<div class="nav-item dropdown d-block d-lg-none">
{{ partial "navbar-lang-selector.html" . }}
</div>
{{ end }} -->
{{ template "blog-nav-section" (dict "page" . "section" .FirstSection "delayActive" $shouldDelayActive) }}
</nav>
</div>
{{ define "blog-nav-section" }}
{{ $shouldDelayActive := .delayActive }}
{{ $sid := .section.RelPermalink | anchorize }}
{{ $postsByYear := .section.Pages.GroupByDate "2006" }}
{{ range $postsByYear }}
{{ $year := .Key }}
{{ $p := $.page }}
{{ $active := eq ($p.Date.Format "2006") $year }}
{{ $firstPost := .Pages | first 1 }}
<ul class="td-sidebar-nav__section pr-md-3">
<li class="td-sidebar-nav__section-title">
<a href="{{range $firstPost}}{{ .RelPermalink }}{{end}}" class="align-left pl-0 pr-2{{ if not $active }} collapsed{{ end }}{{ if $active}} active{{ end }} td-sidebar-link td-sidebar-link__section">
{{ $year }}
</a>
</li>
{{ $firstPages := .Pages | first 10 }}
{{ $remainingPages := .Pages | after 10 }}
{{ $displayRemainingPages := false }}
<ul>
{{ range $firstPages }}
{{ if .IsPage }}
<li class="blog-post collapse {{ if $active }}show{{ end }}" data-year={{$year}}>
{{ $mid := printf "m-%s" (.RelPermalink | anchorize) }}
{{ $active := eq . $p }}
<a class="td-sidebar-link td-sidebar-link__page {{ if and (not $shouldDelayActive) $active }} active{{ end }}" id="{{ $mid }}" href="{{ .RelPermalink }}">
{{ .LinkTitle }}
</a>
</li>
{{ end }}
{{ end }}
<li class="more-posts collapse {{ if $active }}show{{ end }}" data-year="{{$year}}">
<a class="td-sidebar-link" id="more-posts" href="">Show More Posts...</a>
</li>
{{ range $remainingPages }}
{{ if .IsPage }}
<li class="blog-post hidden collapse" data-year={{$year}}>
{{ $mid := printf "m-%s" (.RelPermalink | anchorize) }}
{{ $active := eq . $p }}
<a class="td-sidebar-link td-sidebar-link__page {{ if and (not $shouldDelayActive) $active }} active{{ end }}" id="{{ $mid }}" href="{{ .RelPermalink }}">
{{ .LinkTitle }}
</a>
</li>
{{ end }}
{{ end }}
</ul>
</ul>
{{ end }}
{{ end }}
{{/* Reveal the remaining blog posts and hide the clicked link */}}
<script>
let morePosts = document.querySelectorAll(".more-posts");
let year = "";
morePosts.forEach(link => {
link.onclick = (e) => {
e.preventDefault();
year = link.dataset.year;
console.log(year);
let hiddenPosts = document.querySelectorAll(`.blog-post.hidden[data-year="${year}"]`);
console.log(hiddenPosts);
hiddenPosts.forEach(post => {
post.classList.add('show');
post.classList.remove("hidden");
});
link.style.display = "none";
}
});
</script>
+22 -20
View File
@@ -1,21 +1,20 @@
<!-- All former base stylesheet links commented out as we are using Docsy for styles. -->
{{ $inServerMode := site.IsServer }}
{{ $sass := "sass/style.sass" }}
{{ $cssOutput := "css/style.css" }}
{{ $devOpts := (dict "targetPath" $cssOutput "enableSourceMap" true) }}
{{ $prodOpts := (dict "targetPath" $cssOutput "outputStyle" "compressed") }}
{{ $cssOpts := cond $inServerMode $devOpts $prodOpts }}
{{ $css := resources.Get $sass | resources.ExecuteAsTemplate $sass . | toCSS $cssOpts }}
{{ if $inServerMode }}
<link rel="stylesheet" href="{{ $css.RelPermalink }}">
{{ else }}
{{ $prodCss := $css | fingerprint }}
<link rel="stylesheet" href="{{ $prodCss.RelPermalink }}" integrity="{{ $prodCss.Data.Integrity }}">
{{ end }}
<link rel="stylesheet" href="/css/base_fonts.css">
{{- if .Params.case_study_styles }}
<link rel="stylesheet" href="/css/case-study-styles.css">
{{ $cssOutput := "css/case-studies.css" }}
{{ $caseStudiesCSS := resources.Get "scss/_case-studies.scss" | resources.ToCSS }}
{{ if $inServerMode }}
<link rel="stylesheet" href="{{ $caseStudiesCSS.RelPermalink }}">
{{ else }}
{{ $prodCaseStudiesCSS := $caseStudiesCSS | fingerprint }}
<link rel="stylesheet" href="{{ $prodCaseStudiesCSS.RelPermalink }}" integrity="{{ $prodCaseStudiesCSS.Data.Integrity }}">
{{ end }}
{{- end }}
<link rel="stylesheet" href="{{ "css/jquery-ui.min.css" | relURL }}">
<link rel="stylesheet" href="{{ "css/callouts.css" | relURL }}">
<link rel="stylesheet" href="{{ "css/custom-jekyll/tags.css" | relURL }}">
@@ -25,16 +24,19 @@
{{- if .Site.Params.deprecated }}
<link rel="stylesheet" href="{{ "css/deprecation-warning.css" | relURL }}">
{{- end }}
{{- if or (eq .Params.class "gridPage") (eq .Params.class "gridPage gridPageHome") }}
<link rel="stylesheet" href="{{ "css/gridpage.css" | relURL }}">
<link rel="stylesheet" href="{{ "css/gridpage.css" | relURL }}">
{{- end }}
{{- if eq .Params.class "training" }}
<link rel="stylesheet" href="{{ "css/training.css" | relURL }}">
<link rel="stylesheet" href="{{ "css/training.css" | relURL }}">
{{- end }}
{{- with .Params.css }}
{{- $extraCss := split . "," }}
{{- range $extraCss }}
{{- $url := trim . " " | relURL }}
<link rel="stylesheet" href="{{ $url }}"><!-- custom css added -->
{{- $extraCss := split . "," }}
{{- range $extraCss }}
{{- $url := trim . " " | relURL }}
<link rel="stylesheet" href="{{ $url }}"><!-- custom css added -->
{{- end }}
{{- end }}
{{- end }}
+2 -4
View File
@@ -6,9 +6,7 @@
</a>
</p>
{{ if not .page.Params.notitle }}
<h1>{{ .page.Title }}</h1>
{{ end }}
{{ if and (not .page.Params.toc_hide) (not (.page.HasShortcode "toc")) }}
{{ .page.TableOfContents }}
<h1>{{ .page.Title }}</h1>
{{ end }}
{{ .page.Content }}
@@ -0,0 +1,27 @@
{{ range .Params.cards }}
<div class="launch-card">
<h2 id="{{ replace .title " " "-" | lower }}">{{ .title }}</h2>
<p>{{ .description }}</p>
<ul>
{{ $name := .name }}
{{ range where ($.Site.Pages.ByParam "card.weight") ".Params.card" "!=" nil }}
{{ if eq .Params.card.name $name }}
{{ $p := . }}
{{ if (isset .Params.card "anchors") }}
{{ range .Params.card.anchors }}
<li><a href="{{ $p.Permalink }}{{ .anchor }}">{{ .title }}</a></li>
{{ end }}
{{ else }}
<li><a href={{ .Permalink }}>
{{ if (isset .Params.card "title") }}{{ .Params.card.title }}{{ else }}{{ .LinkTitle }}{{ end }}
</a></li>
{{ end }}
{{ end }}
{{ end }}
</ul>
<br>
<button id="btn-concepts" class="button" onClick="location.href='{{ .button_path | relLangURL }}';" aria-label="{{ .title }}">{{ .button }}</button>
<br>
<br>
</div>
{{ end }}
+4
View File
@@ -0,0 +1,4 @@
<link rel="shortcut icon" type="image/png" href="{{ "images/favicon.png" | relURL }}">
<link rel="apple-touch-icon" href="{{ "favicons/apple-touch-icon-180x180.png" | relURL }}" sizes="180x180">
<link rel="manifest" href="/manifest.webmanifest">
<link rel="apple-touch-icon" href="/images/kubernetes-192x192.png">
+19 -17
View File
@@ -1,22 +1,24 @@
{{ if not .Params.hide_feedback }}
<div id="pre-footer">
<h2>{{ T "feedback_heading" }}</h2>
<p class="feedback--prompt">{{ T "feedback_question" }} </p>
<button class="button feedback--yes">{{ T "feedback_yes" }}</button>
<button class="button feedback--no">{{ T "feedback_no" }}</button>
<p class="feedback--response feedback--response__hidden">
{{ T "layouts_docs_partials_feedback_thanks" }}
<a target="_blank" rel="noopener"
href="https://stackoverflow.com/questions/tagged/kubernetes">
Stack Overflow</a>.
{{ T "layouts_docs_partials_feedback_issue" }}
<a class="feedback--link" target="_blank" rel="noopener"
href="https://github.com/kubernetes/website/issues/new?title=Issue%20with%20k8s.io">
{{ T "layouts_docs_partials_feedback_problem" }}</a>
{{ T "layouts_docs_partials_feedback_or" }}
<a class="feedback--link" target="_blank" rel="noopener"
href="https://github.com/kubernetes/website/issues/new?title=Improvement%20for%20k8s.io">
{{ T "layouts_docs_partials_feedback_improvement" }}</a>.
</p>
<p class="feedback--prompt">{{ T "feedback_question" }} </p>
<button class="btn btn-primary mb-4 feedback--yes">{{ T "feedback_yes" }}</button>
<button class="btn btn-primary mb-4 feedback--no">{{ T "feedback_no" }}</button>
<p class="feedback--response feedback--response__hidden">
{{ T "layouts_docs_partials_feedback_thanks" }}
<a target="_blank" rel="noopener"
href="https://stackoverflow.com/questions/tagged/kubernetes">
Stack Overflow</a>.
{{ T "layouts_docs_partials_feedback_issue" }}
<a class="feedback--link" target="_blank" rel="noopener"
href="https://github.com/kubernetes/website/issues/new?title=Issue%20with%20k8s.io">
{{ T "layouts_docs_partials_feedback_problem" }}</a>
{{ T "layouts_docs_partials_feedback_or" }}
<a class="feedback--link" target="_blank" rel="noopener"
href="https://github.com/kubernetes/website/issues/new?title=Improvement%20for%20k8s.io">
{{ T "layouts_docs_partials_feedback_improvement" }}</a>.
</p>
</div>
<script>
const yes = document.querySelector('.feedback--yes');
const no = document.querySelector('.feedback--no');
+51 -36
View File
@@ -1,37 +1,52 @@
<footer>
<div class="light-text main-section">
<nav>
{{ with site.GetPage "page" "docs/tutorials/stateless-application/hello-minikube" }}<a href="{{ .RelPermalink }}" data-proofer-ignore>{{ .LinkTitle }}</a>{{ end }}
{{ $sections := slice "docs/home" "blog" "training" "partners" "community" "case-studies" }}
{{ range $sections }}
{{ with site.GetPage "section" . }}<a href="{{ .RelPermalink }}" data-proofer-ignore>{{ .LinkTitle }}</a>{{ end }}
{{ end }}
</nav>
<div class="social" role="region" aria-label="Social hyperlinks">
<div>
<a href="https://twitter.com/kubernetesio" class="twitter"><span>{{ T "community_twitter_name" }}</span></a>
<a href="https://github.com/kubernetes/kubernetes" class="github"><span>{{ T "community_github_name" }}</span></a>
<a href="https://slack.k8s.io/" class="slack"><span>Slack</span></a>
</div>
<div>
<a href="https://stackoverflow.com/questions/tagged/kubernetes" class="stack-overflow"><span>{{ T "community_stack_overflow_name" }}</span></a>
<a href="https://www.youtube.com/kubernetescommunity" class="youtube"><span>{{ T "community_youtube_name" }}</span></a>
<a href="https://discuss.kubernetes.io" class="mailing-list"><span>{{ T "community_forum_name" }}</span></a>
<a href="https://calendar.google.com/calendar/embed?src=cgnt364vd8s86hr2phapfjc6uk%40group.calendar.google.com" class="calendar"><span>{{ T "community_events_calendar" }}</span></a>
</div>
<div>
{{ with site.GetPage "page" "/docs/setup/pick-right-solution/" }}<a href="{{ .RelPermalink }}" class="button">{{ .LinkTitle }}</a>{{ end }}
<a href="https://git.k8s.io/community/contributors/guide" class="button">{{ T "main_contribute" }}</a>
</div>
</div>
<div class="miceType center">
&copy; {{ now.Year }} {{ T "main_documentation_license" | safeHTML }}</a>
</div>
<div class="miceType center">
Copyright &copy; {{ now.Year }} {{ T "main_copyright_notice" | safeHTML }}
</div>
<div class="miceType center">
ICP license: 京ICP备17074266号-3
</div>
{{ $links := .Site.Params.links }}
<footer class="d-print-none">
<div class="footer__links">
<nav>
{{ with site.GetPage "page" "docs/tutorials/stateless-application/hello-minikube" }}<a href="{{ .RelPermalink }}">{{ .LinkTitle }}</a>{{ end }}
{{ $sections := slice "docs/home" "blog" "training" "partners" "community" "case-studies" }}
{{ range $sections }}
{{ with site.GetPage "section" . }}<a class="text-white" href="{{ .RelPermalink }}">{{ .LinkTitle }}</a>{{ end }}
{{ end }}
</nav>
</div>
<div class="container-fluid">
<div class="row">
<div class="col-6 col-sm-2 text-xs-center order-sm-2">
{{ with $links }}
{{ with index . "user"}}
{{ template "footer-links-block" . }}
{{ end }}
{{ end }}
</div>
<div class="col-6 col-sm-2 text-right text-xs-center order-sm-3">
{{ with $links }}
{{ with index . "developer"}}
{{ template "footer-links-block" . }}
{{ end }}
{{ end }}
</div>
<div class="col-12 col-sm-8 text-center order-sm-2">
{{ with .Site.Params.copyright_k8s }}<small class="text-white">&copy; {{ now.Year}} {{ T "main_documentation_license" | safeHTML }}</small>{{ end }}
<br/>
{{ with .Site.Params.copyright_linux }}<small class="text-white">Copyright &copy; {{ now.Year }} {{ T "main_copyright_notice" | safeHTML }}</small>{{ end }}
<br/>
<small class="text-white">ICP license: 京ICP备17074266号-3</small>
{{ with .Site.Params.privacy_policy }}<small class="ml-1"><a href="{{ . }}" target="_blank">{{ T "footer_privacy_policy" }}</a></small>{{ end }}
{{ if not .Site.Params.ui.footer_about_disable }}
{{ with .Site.GetPage "about" }}<p class="mt-2"><a href="{{ .RelPermalink }}">{{ .Title }}</a></p>{{ end }}
{{ end }}
</div>
</div>
</footer>
</div>
</footer>
{{ define "footer-links-block" }}
<ul class="list-inline mb-0">
{{ range . }}
<li class="list-inline-item mx-2 h3" data-toggle="tooltip" data-placement="top" title="{{ .name }}" aria-label="{{ .name }}">
<a class="text-white" target="_blank" href="{{ .url }}">
<i class="{{ .icon }}"></i>
</a>
</li>
{{ end }}
</ul>
{{ end }}
+40 -21
View File
@@ -1,32 +1,51 @@
<div id="pre-footer"> <!-- This is at the bottom of every topic underneath the TOC and content -->
<hr />
<div id="pre-footer">
<!-- This is at the bottom of every topic underneath the TOC and content -->
<hr/>
<div class="issue-button-container">
<p><a href=""><img src="https://kubernetes-site.appspot.com/UA-36037335-10/GitHub/{{ .Path }}?pixel" alt="Analytics" /></a></p>
<p>
<a href=""><img alt="Analytics" src="https://kubernetes-site.appspot.com/UA-36037335-10/GitHub/{{ .Path }}?pixel"/></a>
</p>
{{ if and (ne .Kind "404") (not (strings.Contains .Path "search")) }}
{{ if not .Params.no_issue }}
<script type="text/javascript">
PDRTJS_settings_8345992 = {
"id" : "8345992",
"unique_id" : "{{ .RelPermalink }}",
"title" : "{{ .Title }}",
"permalink" : "{{ .Permalink }}"
};
(function(d,c,j){if(!document.getElementById(j)){var pd=d.createElement(c),s;pd.id=j;pd.src=('https:'==document.location.protocol)?'https://polldaddy.com/js/rating/rating.js':'http://i0.poll.fm/js/rating/rating.js';s=document.getElementsByTagName(c)[0];s.parentNode.insertBefore(pd,s);}}(document,'script','pd-rating-js'));
</script>
<a href="" onclick="window.open('https://github.com/kubernetes/website/issues/new?template=bug-report.md&title=Issue%20with%20' +
'k8s.io'+window.location.pathname)" class="button issue">{{ T "main_github_create_an_issue" }}</a>
{{ end }}
{{ if not .Params.no_issue }}
<script type="text/javascript">
PDRTJS_settings_8345992 = {
"id": "8345992",
"unique_id": "{{ .RelPermalink }}",
"title": "{{ .Title }}",
"permalink": "{{ .Permalink }}"
};
(function (d, c, j) {
if (!document.getElementById(j)) {
var pd = d.createElement(c),
s;
pd.id = j;
pd.src = ("https:" == document.location.protocol)
? "https://polldaddy.com/js/rating/rating.js"
: "http://i0.poll.fm/js/rating/rating.js";
s = document.getElementsByTagName(c)[0];
s.parentNode.insertBefore(pd, s);
}
}(document, "script", "pd-rating-js"));
</script>
<a class="btn btn-primary mb-4 issue" href="" onclick="window.open('https://github.com/kubernetes/website/issues/new?template=bug-report.md&title=Issue%20with%20' +
'k8s.io'+window.location.pathname)">{{ T "main_github_create_an_issue" }}</a>
{{ end }}
{{ end }}
{{ if not .Params.noedit }}
{{ if .File }}<a href="https://github.com/kubernetes/website/edit/master/content/{{ site.Language.Lang }}/{{ .File.Path }}" class="button issue">{{ T "main_edit_this_page" }}</a>{{ end }}
{{ if .File }}
<a class="btn btn-primary mb-4 issue" href="https://github.com/kubernetes/website/edit/master/content/{{ site.Language.Lang }}/{{ .File.Path }}">{{ T "main_edit_this_page" }}</a>
{{ end }}
{{ end }}
</div>
{{ if and (not .Params.showcommit) $.GitInfo }}
<div id="lastedit" class="lastedit issue-button-container">
{{ T "main_page_last_modified_on" }} {{ .GitInfo.AuthorDate.Format "January 02, 2006 at 3:04 PM PST" }} {{ T "main_by" }}
<a href="https://github.com/kubernetes/website/commit/{{ .GitInfo.Hash }}/">{{ .GitInfo.Subject }}</a> (<a href="https://github.com/kubernetes/website/commits/master/content/{{ site.Language.Lang }}/{{ .File.Path }}">{{ T "main_page_history" }}</a>)
</div>
<div class="lastedit issue-button-container" id="lastedit">
{{ T "main_page_last_modified_on" }}
{{ .GitInfo.AuthorDate.Format "January 02, 2006 at 3:04 PM PST" }}
{{ T "main_by" }}
<a href="https://github.com/kubernetes/website/commit/{{ .GitInfo.Hash }}/">{{ .GitInfo.Subject }}</a>
(<a href="https://github.com/kubernetes/website/commits/master/content/en/{{ .File.Path }}">{{ T "main_page_history" }}</a>)
</div>
{{ end }}
</div>
+36 -8
View File
@@ -9,8 +9,42 @@
gtag('config', 'UA-36037335-10');
</script>
<!-- Docsy head.html begins here -->
<meta charset="utf-8">
<title>{{ if .Title }}{{ .Title }} - {{ end }}{{ site.Title }}</title>
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
{{ hugo.Generator }}
{{ if eq (getenv "HUGO_ENV") "production" }}
<META NAME="ROBOTS" CONTENT="INDEX, FOLLOW">
{{ else }}
<META NAME="ROBOTS" CONTENT="NOINDEX, NOFOLLOW">
{{ end }}
{{ range .AlternativeOutputFormats -}}
<link rel="{{ .Rel }}" type="{{ .MediaType.Type }}" href="{{ .Permalink | safeURL }}">
{{ end -}}
{{ partialCached "favicons.html" . }}
<title>{{ if .IsHome }}{{ .Site.Title }}{{ else }}{{ with .Title }}{{ . }} | {{ end }}{{ .Site.Title }}{{ end }}</title>
{{- template "_internal/opengraph.html" . -}}
{{- template "_internal/google_news.html" . -}}
{{- template "_internal/schema.html" . -}}
{{- template "_internal/twitter_cards.html" . -}}
{{ if eq (getenv "HUGO_ENV") "production" }}
{{ template "_internal/google_analytics_async.html" . }}
{{ end }}
{{ partialCached "head-css.html" . "asdf" }}
<script
src="https://code.jquery.com/jquery-3.3.1.min.js"
integrity="sha256-FgpCb/KJQlLNfOu91ta32o/NMZxltwRo8QtmkMRdAu8="
crossorigin="anonymous"></script>
{{ if and (.Site.Params.offlineSearch) (not .Site.Params.gcs_engine_id) }}
<script src="https://unpkg.com/lunr@2.1.6/lunr.js"></script>
<script src="/js/offline-search.js"></script>
{{end}}
{{ partial "hooks/head-end.html" . }}
<!-- Docsy head.html ends here -->
<script type="application/ld+json">
{
"@context": "https://schema.org",
@@ -19,9 +53,7 @@
"logo": "https://kubernetes.io/images/favicon.png"
}
</script>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="theme-color" content="#326ce5">
<link rel="shortcut icon" type="image/png" href="{{ "images/favicon.png" | relURL }}">
{{ partial "css.html" . }}
<!-- Content for social media sharing previews -->
<!-- Facebook uses the og: stuff, while Twitter and others use twitter: -->
@@ -43,9 +75,7 @@
{{ end }}
<meta property="og:type" content="{{ $ogType }}">
<script src="{{ "js/anchor-4.1.1.min.js" | relURL }}"></script>
<script src="{{ "js/jquery-3.2.1.min.js" | relURL }}"></script>
<script src="{{ "js/jquery-ui-1.12.1.min.js" | relURL }}"></script>
<script src="{{ "js/bootstrap-4.3.1.min.js" | relURL }}"></script>
<script src="{{ "js/sweetalert-2.1.2.min.js" | relURL }}"></script>
{{ if eq .Params.mermaid true }}
@@ -56,6 +86,4 @@
<script src="{{ "js/script.js" | relURL }}"></script>
<script src="{{ "js/custom-jekyll/tags.js" | relURL }}"></script>
{{ with .Params.js }}{{ range (split . ",") }}<script src="{{ (trim . " ") | relURL }}"></script><!-- custom js added -->
{{ end }}{{ else }}<!-- no custom js detected -->{{ end }}
<link rel="manifest" href="/manifest.webmanifest">
<link rel="apple-touch-icon" href="/images/kubernetes-192x192.png">
{{ end }}{{ else }}<!-- no custom js detected -->{{ end }}
+30
View File
@@ -0,0 +1,30 @@
{{ $cover := .HasShortcode "blocks/cover" }}
<nav class="js-navbar-scroll navbar navbar-expand navbar-dark {{ if $cover}} td-navbar-cover {{ end }} flex-row td-navbar" data-auto-burger="primary">
<a class="navbar-brand" href="{{ .Site.Home.RelPermalink }}"></a>
<div class="td-navbar-nav-scroll ml-md-auto" id="main_navbar">
<ul class="navbar-nav mt-2 mt-lg-0">
{{ $p := . }}
{{ $sections := slice "docs" "blog" "training" "partners" "community" "case-studies" }}
{{ range $sections }}
{{ with site.GetPage "section" . }}
<li class="nav-item mr-2 mb-lg-0">
{{ $active := eq .Section $.Section }}
<a class="nav-link{{if $active }} active{{end}}" href="{{ .RelPermalink }}" >{{ .LinkTitle }}</span></a>
</li>
{{ end }}
{{ end }}
{{ if .Site.Params.versions }}
<li class="nav-item dropdown">
{{ partial "navbar-version-selector.html" . }}
</li>
{{ end }}
{{ if (gt (len .Site.Home.Translations) 0) }}
<li class="nav-item dropdown">
{{ partial "navbar-lang-selector.html" . }}
</li>
{{ end }}
</ul>
</div>
<button id="hamburger" onclick="kub.toggleMenu()" data-auto-burger-exclude><div></div></button>
</nav>
+10
View File
@@ -0,0 +1,10 @@
{{ if or .Site.Params.gcs_engine_id .Site.Params.algolia_docsearch }}
<input type="search" class="form-control td-search-input" placeholder="&#xf002 {{ T "ui_search" }}" aria-label="{{ T "ui_search" }}" autocomplete="off">
{{ else if .Site.Params.offlineSearch }}
<div id="search-nav-container">
<input type="search" id="search-input" autocomplete="off" class="form-control td-search-input" placeholder="&#xf002 {{ T "ui_search" }}" autocomplete="on">
<div id="search-results" class="container"></div>
</div>
{{ else if .Site.Params.k8s_search }}
<input type="search" class="form-control td-search-input" name="q" placeholder="&#xf002 {{ T "ui_search" }}" aria-label="{{ T "ui_search" }}" autocomplete="off">
{{ end }}
+63
View File
@@ -0,0 +1,63 @@
{{/* We cache this partial for bigger sites and set the active class client side. */}}
{{ $shouldDelayActive := ge (len .Site.Pages) 2000 }}
<div id="td-sidebar-menu" class="td-sidebar__inner{{ if $shouldDelayActive }} d-none{{ end }}">
{{ if not .Site.Params.ui.sidebar_search_disable }}
<form class="td-sidebar__search d-flex align-items-center">
{{ partial "search-input.html" . }}
<button class="btn btn-link td-sidebar__toggle d-md-none p-0 ml-3 fas fa-bars" type="button" data-toggle="collapse" data-target="#td-section-nav" aria-controls="td-docs-nav" aria-expanded="false" aria-label="Toggle section navigation">
</button>
</form>
{{ end }}
<nav class="collapse td-sidebar-nav pt-2 pl-4" id="td-section-nav">
<!-- {{ if (gt (len .Site.Home.Translations) 0) }}
<div class="nav-item dropdown d-block d-lg-none">
{{ partial "navbar-lang-selector.html" . }}
</div>
{{ end }} -->
{{ $currentLang := .Site.Language }}
{{ template "section-tree-nav-section" (dict "page" . "section" .FirstSection "delayActive" $shouldDelayActive "currentLang" $currentLang) }}
</nav>
</div>
{{ define "section-tree-nav-section" }}
{{ $s := .section }}
{{ $p := .page }}
{{ $shouldDelayActive := .delayActive }}
{{ $active := eq $p.CurrentSection $s }}
{{ $show := or (eq $s $p.FirstSection) (and (not $p.Site.Params.ui.sidebar_menu_compact) ($p.IsDescendant $s)) }}
{{ $sid := $s.RelPermalink | anchorize }}
<ul class="td-sidebar-nav__section pr-md-3">
<li class="td-sidebar-nav__section-title">
<a href="{{ $s.RelPermalink }}" class="align-left pl-0 pr-2{{ if not $show }} collapsed{{ end }}{{ if $active}} active{{ end }} td-sidebar-link td-sidebar-link__section">
{{ if not (eq $s.LinkTitle "Documentation") }}
{{ $s.LinkTitle }}
{{ end }}
</a>
</li>
<ul>
<li class="collapse {{ if $show }}show{{ end }}" id="{{ $sid }}">
{{ $pages := where (union $s.Pages $s.Sections).ByWeight ".Params.toc_hide" "!=" true }}
{{ with site.Params.language_alternatives }}
{{ range . }}
{{ with (where $.section.Translations ".Lang" . ) }}
{{ $p := index . 0 }}
{{ $pages = $pages | lang.Merge (union $p.Pages $p.Sections) }}
{{ end }}
{{ end }}
{{ end }}
{{ $pages := $pages | first 50 }}
{{ range $pages }}
{{ if .IsPage }}
{{ $mid := printf "m-%s" (.RelPermalink | anchorize) }}
{{ $active := eq . $p }}
{{ $isForeignLanguage := (ne (string .Lang) (string $.currentLang)) }}
<a class="td-sidebar-link td-sidebar-link__page {{ if and (not $shouldDelayActive) $active }} active{{ end }}" id="{{ $mid }}" {{ if $isForeignLanguage }}target="_blank"{{ end }} href="{{ .RelPermalink }}">
{{ .LinkTitle }}{{ if $isForeignLanguage }} <small>({{ .Lang | upper }})</small>{{ end }}
</a>
{{ else }}
{{ template "section-tree-nav-section" (dict "page" $p "section" . "currentLang" $.currentLang) }}
{{ end }}
{{ end }}
</li>
</ul>
</ul>
{{ end }}
-37
View File
@@ -1,37 +0,0 @@
<a class="item" data-title="{{ .LinkTitle }}" href="{{ .RelPermalink }}" data-proofer-ignore></a>
{{ template "section-tree-nav" (dict "ctx" . "section" .) }}
{{ define "section-tree-nav" }}
{{ $pages := (union .section.Pages .section.Sections) }}
{{ with site.Params.language_alternatives }}
{{ range . }}
{{ with (where $.section.Translations ".Lang" . ) }}
{{ $p := index . 0 }}
{{ $pages = $pages | lang.Merge (union $p.Pages $p.Sections) }}
{{ end }}
{{ end }}
{{ end }}
{{ $sections := where $pages.ByWeight ".Params.toc_hide" "!=" true }}
{{ range $sections }}
{{ if .IsPage }}
{{ template "section-tree-nav-page" (dict "ctx" $.ctx "page" .) }}
{{ else }}
{{ template "section-tree-nav-section" (dict "ctx" $.ctx "section" .) }}
{{ end }}
{{ end }}
{{ end }}
{{ define "section-tree-nav-section" }}
<div class="item" data-title="{{ .section.LinkTitle }}">
<div class="container">
{{ if ge (len .section.Content) 10 }}
{{/* The section page has content, so link to it. */}}
{{ $isForeignLanguage := (ne .section.Lang $.ctx.Lang)}}
<a class="item" {{ if $isForeignLanguage }}target="_blank" {{ end }}data-title="{{ .section.LinkTitle }}{{ if $isForeignLanguage }} <small>({{ .section.Lang | upper }})</small>{{ end }}" href="{{ .section.RelPermalink }}" data-proofer-ignore></a>
{{ end }}
{{ template "section-tree-nav" . }}
</div>
</div>
{{ end }}
{{ define "section-tree-nav-page" }}
{{ $isForeignLanguage := (ne .page.Lang $.ctx.Lang)}}
<a class="item" {{ if $isForeignLanguage }}target="_blank" {{ end }}data-title="{{ .page.LinkTitle }}{{ if $isForeignLanguage }} <small>({{ .page.Lang | upper }})</small>{{ end }}" href="{{ .page.RelPermalink }}" data-proofer-ignore></a>
{{ end }}