mirror of
https://github.com/kubernetes-sigs/kustomize.git
synced 2026-06-12 01:14:22 +00:00
Convert docs to docsy
This commit is contained in:
18
site/themes/docsy/layouts/partials/breadcrumb.html
Normal file
18
site/themes/docsy/layouts/partials/breadcrumb.html
Normal file
@@ -0,0 +1,18 @@
|
||||
<nav aria-label="breadcrumb" class="d-none d-md-block d-print-none">
|
||||
<ol class="breadcrumb spb-1">
|
||||
{{ template "breadcrumbnav" (dict "p1" . "p2" .) }}
|
||||
</ol>
|
||||
</nav >
|
||||
{{ define "breadcrumbnav" }}
|
||||
{{ if .p1.Parent }}
|
||||
{{ if not .p1.Parent.IsHome }}
|
||||
{{ template "breadcrumbnav" (dict "p1" .p1.Parent "p2" .p2 ) }}
|
||||
{{ end }}
|
||||
{{ else if not .p1.IsHome }}
|
||||
{{ template "breadcrumbnav" (dict "p1" .p1.Site.Home "p2" .p2 ) }}
|
||||
{{ end }}
|
||||
{{ $isActive := eq .p1 .p2 }}
|
||||
<li class="breadcrumb-item{{ if $isActive }} active{{ end }}" {{ if $isActive }}aria-current="page"{{ end }}>
|
||||
<a href="{{ .p1.Permalink }}">{{ .p1.LinkTitle }}</a>
|
||||
</li>
|
||||
{{ end }}
|
||||
29
site/themes/docsy/layouts/partials/community_links.html
Normal file
29
site/themes/docsy/layouts/partials/community_links.html
Normal file
@@ -0,0 +1,29 @@
|
||||
{{ $links := .Site.Params.links }}
|
||||
|
||||
<section class="row td-box td-box--4 td-box--gradient td-box--height-auto linkbox">
|
||||
<div class="col-xs-12 col-sm-6 col-md-6 col-lg-6">
|
||||
<h2>Learn and Connect</h2>
|
||||
<p>Using or want to use {{ .Site.Title }}? Find out more here:
|
||||
{{ with index $links "user"}}
|
||||
{{ template "community-links-list" . }}
|
||||
{{ end }}
|
||||
</div>
|
||||
<div class="col-xs-12 col-sm-6 col-md-6 col-lg-6">
|
||||
<h2>Develop and Contribute</h2>
|
||||
<p>If you want to get more involved by contributing to {{ .Site.Title }}, join us here:
|
||||
{{ with index $links "developer"}}
|
||||
{{ template "community-links-list" . }}
|
||||
{{ end }}
|
||||
<p>You can find out how to contribute to these docs in our <a href="/docs/contribution-guidelines/">Contribution Guidelines</a>.
|
||||
</div>
|
||||
</section>
|
||||
|
||||
{{ define "community-links-list" }}
|
||||
<ul>
|
||||
{{ range . }}
|
||||
<li title="{{ .name }}">
|
||||
<a target="_blank" href="{{ .url }}"><i class="{{ .icon }}"></i> {{ .name }}:</a> {{ .desc }}
|
||||
</li>
|
||||
{{ end }}
|
||||
</ul>
|
||||
{{ end }}
|
||||
23
site/themes/docsy/layouts/partials/disqus-comment.html
Normal file
23
site/themes/docsy/layouts/partials/disqus-comment.html
Normal file
@@ -0,0 +1,23 @@
|
||||
<div class="page-blank">
|
||||
|
||||
<div id="disqus_thread"></div>
|
||||
<script>
|
||||
|
||||
/**
|
||||
* RECOMMENDED CONFIGURATION VARIABLES: EDIT AND UNCOMMENT THE SECTION BELOW TO INSERT DYNAMIC VALUES FROM YOUR PLATFORM OR CMS.
|
||||
* LEARN WHY DEFINING THESE VARIABLES IS IMPORTANT: https://disqus.com/admin/universalcode/#configuration-variables*/
|
||||
/*
|
||||
var disqus_config = function () {
|
||||
this.page.url = PAGE_URL; // Replace PAGE_URL with your page's canonical URL variable
|
||||
this.page.identifier = PAGE_IDENTIFIER; // Replace PAGE_IDENTIFIER with your page's unique identifier variable
|
||||
};
|
||||
*/
|
||||
(function() { // DON'T EDIT BELOW THIS LINE
|
||||
var d = document, s = d.createElement('script');
|
||||
s.src = 'https://' + {{ .Site.DisqusShortname }} + '.disqus.com/embed.js';
|
||||
s.setAttribute('data-timestamp', +new Date());
|
||||
(d.head || d.body).appendChild(s);
|
||||
})();
|
||||
</script>
|
||||
<noscript>Please enable JavaScript to view the <a href="https://disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript>
|
||||
</div>
|
||||
12
site/themes/docsy/layouts/partials/favicons.html
Normal file
12
site/themes/docsy/layouts/partials/favicons.html
Normal file
@@ -0,0 +1,12 @@
|
||||
|
||||
<!-- Favicons as generated by http://cthedot.de/icongen -->
|
||||
<link rel="shortcut icon" href="/favicons/favicon.ico" >
|
||||
<link rel="apple-touch-icon" href="{{ "favicons/apple-touch-icon-180x180.png" | relURL }}" sizes="180x180">
|
||||
<link rel="icon" type="image/png" href="{{ "favicons/favicon-16x16.png" | relURL }}" sizes="16x16">
|
||||
<link rel="icon" type="image/png" href="{{ "favicons/favicon-32x32.png" | relURL }}" sizes="32x32">
|
||||
<link rel="icon" type="image/png" href="{{ "favicons/android-36x36.png" | relURL }}" sizes="36x36">
|
||||
<link rel="icon" type="image/png" href="{{ "favicons/android-48x48.png" | relURL }}" sizes="48x48">
|
||||
<link rel="icon" type="image/png" href="{{ "favicons/android-72x72.png" | relURL }}" sizes="72x72">
|
||||
<link rel="icon" type="image/png" href="{{ "favicons/android-96x96.png" | relURL }}" sizes="96x96">
|
||||
<link rel="icon" type="image/png" href="{{ "favicons/android-144x144.png" | relURL }}" sizes="144x144">
|
||||
<link rel="icon" type="image/png" href="{{ "favicons/android-192x192.png" | relURL }}" sizes="192x192">
|
||||
14
site/themes/docsy/layouts/partials/featured-image.html
Normal file
14
site/themes/docsy/layouts/partials/featured-image.html
Normal file
@@ -0,0 +1,14 @@
|
||||
{{ $w := .w | default 480 }}
|
||||
{{ $h := .h | default 180 }}
|
||||
{{ $p := .p }}
|
||||
{{ $class := .class | default "ml-3" }}
|
||||
{{ $image := ($p.Resources.ByType "image").GetMatch "**featured*" }}
|
||||
{{ with $image }}
|
||||
{{ $image := .Fill (printf "%dx%d" $w $h ) }}
|
||||
<figure class="{{ $class }}" style="width: {{ $image.Width }}px">
|
||||
<img src="{{ $image.RelPermalink }}" alt="Featured Image for {{ $p.Title }}" width="{{ $image.Width }}" height="{{ $image.Height }}">
|
||||
{{ with $image.Params.byline }}
|
||||
<figcaption class="mt-2 mt-md-0"><small class="text-muted">{{ . | html }}</small></figcaption>
|
||||
{{ end }}
|
||||
</figure>
|
||||
{{ end }}
|
||||
57
site/themes/docsy/layouts/partials/feedback.html
Normal file
57
site/themes/docsy/layouts/partials/feedback.html
Normal file
@@ -0,0 +1,57 @@
|
||||
<style>
|
||||
.feedback--answer {
|
||||
display: inline-block;
|
||||
}
|
||||
.feedback--answer-no {
|
||||
margin-left: 1em;
|
||||
}
|
||||
.feedback--response {
|
||||
display: none;
|
||||
margin-top: 1em;
|
||||
}
|
||||
.feedback--response__visible {
|
||||
display: block;
|
||||
}
|
||||
</style>
|
||||
<h2 class="feedback--title">Feedback</h2>
|
||||
<p class="feedback--question">Was this page helpful?</p>
|
||||
<button class="feedback--answer feedback--answer-yes">Yes</button>
|
||||
<button class="feedback--answer feedback--answer-no">No</button>
|
||||
<p class="feedback--response feedback--response-yes">
|
||||
{{ .yes | safeHTML }}
|
||||
</p>
|
||||
<p class="feedback--response feedback--response-no">
|
||||
{{ .no | safeHTML }}
|
||||
</p>
|
||||
<script>
|
||||
const yesButton = document.querySelector('.feedback--answer-yes');
|
||||
const noButton = document.querySelector('.feedback--answer-no');
|
||||
const yesResponse = document.querySelector('.feedback--response-yes');
|
||||
const noResponse = document.querySelector('.feedback--response-no');
|
||||
const disableButtons = () => {
|
||||
yesButton.disabled = true;
|
||||
noButton.disabled = true;
|
||||
};
|
||||
const sendFeedback = (value) => {
|
||||
if (typeof ga !== 'function') return;
|
||||
const args = {
|
||||
command: 'send',
|
||||
hitType: 'event',
|
||||
category: 'Helpful',
|
||||
action: 'click',
|
||||
label: window.location.pathname,
|
||||
value: value
|
||||
};
|
||||
ga(args.command, args.hitType, args.category, args.action, args.label, args.value);
|
||||
};
|
||||
yesButton.addEventListener('click', () => {
|
||||
yesResponse.classList.add('feedback--response__visible');
|
||||
disableButtons();
|
||||
sendFeedback(1);
|
||||
});
|
||||
noButton.addEventListener('click', () => {
|
||||
noResponse.classList.add('feedback--response__visible');
|
||||
disableButtons();
|
||||
sendFeedback(0);
|
||||
});
|
||||
</script>
|
||||
39
site/themes/docsy/layouts/partials/footer.html
Normal file
39
site/themes/docsy/layouts/partials/footer.html
Normal file
@@ -0,0 +1,39 @@
|
||||
{{ $links := .Site.Params.links }}
|
||||
<footer class="bg-dark py-5 row d-print-none">
|
||||
<div class="container-fluid mx-sm-5">
|
||||
<div class="row">
|
||||
<div class="col-6 col-sm-4 text-xs-center order-sm-2">
|
||||
{{ with $links }}
|
||||
{{ with index . "user"}}
|
||||
{{ template "footer-links-block" . }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
</div>
|
||||
<div class="col-6 col-sm-4 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-4 text-center py-2 order-sm-2">
|
||||
{{ with .Site.Params.copyright }}<small class="text-white">© {{ now.Year}} {{ .}} {{ T "footer_all_rights_reserved" }}</small>{{ end }}
|
||||
{{ 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>
|
||||
</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 }}
|
||||
11
site/themes/docsy/layouts/partials/head-css.html
Normal file
11
site/themes/docsy/layouts/partials/head-css.html
Normal file
@@ -0,0 +1,11 @@
|
||||
|
||||
{{ $scssMain := "scss/main.scss"}}
|
||||
{{ if .Site.IsServer }}
|
||||
{{/* Note the missing postCSS. This makes it snappier to develop in Chrome, but makes it look sub-optimal in other browsers. */}}
|
||||
{{ $css := resources.Get $scssMain | toCSS (dict "enableSourceMap" true) }}
|
||||
<link href="{{ $css.RelPermalink }}" rel="stylesheet">
|
||||
{{ else }}
|
||||
{{ $css := resources.Get $scssMain | toCSS (dict "enableSourceMap" false) | postCSS | minify | fingerprint }}
|
||||
<link rel="preload" href="{{ $css.RelPermalink }}" as="style">
|
||||
<link href="{{ $css.RelPermalink }}" rel="stylesheet" integrity="{{ $css.Data.integrity }}">
|
||||
{{ end }}
|
||||
32
site/themes/docsy/layouts/partials/head.html
Normal file
32
site/themes/docsy/layouts/partials/head.html
Normal file
@@ -0,0 +1,32 @@
|
||||
<meta charset="utf-8">
|
||||
<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 .Site.Params.offlineSearch }}
|
||||
<script
|
||||
src="https://unpkg.com/lunr@2.3.8/lunr.min.js"
|
||||
integrity="sha384-vRQ9bDyE0Wnu+lMfm57BlYLO0/XauFuKpVsZPs7KEDwYKktWi5+Kz3MP8++DFlRY"
|
||||
crossorigin="anonymous"></script>
|
||||
{{end}}
|
||||
{{ partial "hooks/head-end.html" . }}
|
||||
3
site/themes/docsy/layouts/partials/hooks/body-end.html
Normal file
3
site/themes/docsy/layouts/partials/hooks/body-end.html
Normal file
@@ -0,0 +1,3 @@
|
||||
{{ with .Site.Params.algolia_docsearch }}
|
||||
<!-- scripts for algolia docsearch -->
|
||||
{{ end }}
|
||||
3
site/themes/docsy/layouts/partials/hooks/head-end.html
Normal file
3
site/themes/docsy/layouts/partials/hooks/head-end.html
Normal file
@@ -0,0 +1,3 @@
|
||||
{{ with .Site.Params.algolia_docsearch }}
|
||||
<!-- stylesheet for algolia docsearch -->
|
||||
{{ end }}
|
||||
10
site/themes/docsy/layouts/partials/navbar-lang-selector.html
Normal file
10
site/themes/docsy/layouts/partials/navbar-lang-selector.html
Normal file
@@ -0,0 +1,10 @@
|
||||
{{/* Link directly to documentation etc., if possible. */}}
|
||||
{{ $langPage := cond (gt (len .Translations) 0) . .Site.Home }}
|
||||
<a class="nav-link dropdown-toggle" href="#" id="navbarDropdown" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
|
||||
{{ $langPage.Language.LanguageName }}
|
||||
</a>
|
||||
<div class="dropdown-menu" aria-labelledby="navbarDropdownMenuLink">
|
||||
{{ range $langPage.Translations }}
|
||||
<a class="dropdown-item" href="{{ .RelPermalink }}">{{ .Language.LanguageName }}</a>
|
||||
{{ end }}
|
||||
</div>
|
||||
@@ -0,0 +1,8 @@
|
||||
<a class="nav-link dropdown-toggle" href="#" id="navbarDropdown" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
|
||||
{{ .Site.Params.version_menu }}
|
||||
</a>
|
||||
<div class="dropdown-menu" aria-labelledby="navbarDropdownMenuLink">
|
||||
{{ range .Site.Params.versions }}
|
||||
<a class="dropdown-item" href="{{ .url }}">{{ .version }}</a>
|
||||
{{ end }}
|
||||
</div>
|
||||
33
site/themes/docsy/layouts/partials/navbar.html
Normal file
33
site/themes/docsy/layouts/partials/navbar.html
Normal file
@@ -0,0 +1,33 @@
|
||||
{{ $cover := .HasShortcode "blocks/cover" }}
|
||||
<nav class="js-navbar-scroll navbar navbar-expand navbar-dark {{ if $cover}} td-navbar-cover {{ end }}flex-column flex-md-row td-navbar">
|
||||
<a class="navbar-brand" href="{{ .Site.Home.RelPermalink }}">
|
||||
<span class="navbar-logo">{{ if .Site.Params.ui.navbar_logo }}{{ with resources.Get "icons/logo.svg" }}{{ ( . | minify).Content | safeHTML }}{{ end }}{{ end }}</span><span class="text-uppercase font-weight-bold">{{ .Site.Title }}</span>
|
||||
</a>
|
||||
<div class="td-navbar-nav-scroll ml-md-auto" id="main_navbar">
|
||||
<ul class="navbar-nav mt-2 mt-lg-0">
|
||||
{{ $p := . }}
|
||||
{{ range .Site.Menus.main }}
|
||||
<li class="nav-item mr-4 mb-2 mb-lg-0">
|
||||
{{ $active := or ($p.IsMenuCurrent "main" .) ($p.HasMenuCurrent "main" .) }}
|
||||
{{ with .Page }}
|
||||
{{ $active = or $active ( $.IsDescendant .) }}
|
||||
{{ end }}
|
||||
{{ $url := urls.Parse .URL }}
|
||||
{{ $baseurl := urls.Parse $.Site.Params.Baseurl }}
|
||||
<a class="nav-link{{if $active }} active{{end}}" href="{{ with .Page }}{{ .RelPermalink }}{{ else }}{{ .URL | relLangURL }}{{ end }}" {{ if ne $url.Host $baseurl.Host }}target="_blank" {{ end }}><span{{if $active }} class="active"{{end}}>{{ .Name }}</span></a>
|
||||
</li>
|
||||
{{ end }}
|
||||
{{ if .Site.Params.versions }}
|
||||
<li class="nav-item dropdown d-none d-lg-block">
|
||||
{{ partial "navbar-version-selector.html" . }}
|
||||
</li>
|
||||
{{ end }}
|
||||
{{ if (gt (len .Site.Home.Translations) 0) }}
|
||||
<li class="nav-item dropdown d-none d-lg-block">
|
||||
{{ partial "navbar-lang-selector.html" . }}
|
||||
</li>
|
||||
{{ end }}
|
||||
</ul>
|
||||
</div>
|
||||
<div class="navbar-nav d-none d-lg-block">{{ partial "search-input.html" . }}</div>
|
||||
</nav>
|
||||
@@ -0,0 +1 @@
|
||||
{{ T "post_last_mod"}} {{ .Lastmod.Format .Site.Params.time_format_default }}{{ with .GitInfo }}: <a href="{{ $.Site.Params.github_repo }}/commit/{{ .Hash }}">{{ .Subject }} ({{ .AbbreviatedHash }})</a>{{end }}
|
||||
26
site/themes/docsy/layouts/partials/page-meta-links.html
Normal file
26
site/themes/docsy/layouts/partials/page-meta-links.html
Normal file
@@ -0,0 +1,26 @@
|
||||
{{ if .Path }}
|
||||
{{ $pathFormatted := replace .Path "\\" "/" }}
|
||||
{{ $gh_repo := ($.Param "github_repo") }}
|
||||
{{ $gh_subdir := ($.Param "github_subdir") }}
|
||||
{{ $gh_project_repo := ($.Param "github_project_repo") }}
|
||||
{{ $gh_branch := (default "master" ($.Param "github_branch")) }}
|
||||
{{ if $gh_repo }}
|
||||
<div class="td-page-meta ml-2 pb-1 pt-2 mb-0">
|
||||
{{ $editURL := printf "%s/edit/%s/content/%s" $gh_repo $gh_branch $pathFormatted }}
|
||||
{{ if and ($gh_subdir) (.Site.Language.Lang) }}
|
||||
{{ $editURL = printf "%s/edit/%s/%s/content/%s/%s" $gh_repo $gh_branch $gh_subdir ($.Site.Language.Lang) $pathFormatted }}
|
||||
{{ else if .Site.Language.Lang }}
|
||||
{{ $editURL = printf "%s/edit/%s/content/%s/%s" $gh_repo $gh_branch ($.Site.Language.Lang) $pathFormatted }}
|
||||
{{ else if $gh_subdir }}
|
||||
{{ $editURL = printf "%s/edit/%s/%s/content/%s" $gh_repo $gh_branch $gh_subdir $pathFormatted }}
|
||||
{{ end }}
|
||||
{{ $issuesURL := printf "%s/issues/new?title=%s" $gh_repo (htmlEscape $.Title )}}
|
||||
<a href="{{ $editURL }}" target="_blank"><i class="fa fa-edit fa-fw"></i> {{ T "post_edit_this" }}</a>
|
||||
<a href="{{ $issuesURL }}" target="_blank"><i class="fab fa-github fa-fw"></i> {{ T "post_create_issue" }}</a>
|
||||
{{ if $gh_project_repo }}
|
||||
{{ $project_issueURL := printf "%s/issues/new" $gh_project_repo }}
|
||||
<a href="{{ $project_issueURL }}" target="_blank"><i class="fas fa-tasks fa-fw"></i> {{ T "post_create_project_issue" }}</a>
|
||||
{{ end }}
|
||||
</div>
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
7
site/themes/docsy/layouts/partials/pager.html
Normal file
7
site/themes/docsy/layouts/partials/pager.html
Normal file
@@ -0,0 +1,7 @@
|
||||
<ul class="list-unstyled d-flex justify-content-between align-items-center mb-0 pt-5">
|
||||
<li>
|
||||
<a {{if .PrevInSection}}href="{{.PrevInSection.RelPermalink}}"{{end}} class="btn btn-primary {{if not .PrevInSection}} disabled{{end}}"><span class="mr-1">←</span> {{ T "ui_pager_prev" }}</a>
|
||||
</li>
|
||||
<a {{if .NextInSection}}href="{{.NextInSection.RelPermalink}}"{{end}} class="btn btn-primary {{if not .NextInSection}} disabled{{end}}">{{ T "ui_pager_next" }} <span class="ml-1">→</span></a>
|
||||
</li>
|
||||
</ul>
|
||||
17
site/themes/docsy/layouts/partials/scripts.html
Normal file
17
site/themes/docsy/layouts/partials/scripts.html
Normal file
@@ -0,0 +1,17 @@
|
||||
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js" integrity="sha384-ZMP7rVo3mIykV+2+9J3UJ46jBk0WLaUAdn689aCwoqbBJiSnjAK/l8WvCWPIPm49" crossorigin="anonymous"></script>
|
||||
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js" integrity="sha384-ChfqqxuZUCnJSK3+MXmPNIyE6ZbWh2IMqE241rYiqJxyMiZ6OW/JmZQ5stwEULTy" crossorigin="anonymous"></script>
|
||||
{{ $jsBase := resources.Get "js/base.js" }}
|
||||
{{ $jsAnchor := resources.Get "js/anchor.js" }}
|
||||
{{ $jsSearch := resources.Get "js/search.js" | resources.ExecuteAsTemplate "js/search.js" .Site.Home }}
|
||||
{{ if .Site.Params.offlineSearch }}
|
||||
{{ $jsSearch = resources.Get "js/offline-search.js" }}
|
||||
{{ end }}
|
||||
{{ $js := (slice $jsBase $jsAnchor $jsSearch) | resources.Concat "js/main.js" }}
|
||||
{{ if .Site.IsServer }}
|
||||
<script src="{{ $js.RelPermalink }}"></script>
|
||||
{{ else }}
|
||||
{{ $js := $js | minify | fingerprint }}
|
||||
<script src="{{ $js.RelPermalink }}" integrity="{{ $js.Data.Integrity }}" crossorigin="anonymous"></script>
|
||||
{{ end }}
|
||||
{{ partial "hooks/body-end.html" . }}
|
||||
22
site/themes/docsy/layouts/partials/search-input.html
Normal file
22
site/themes/docsy/layouts/partials/search-input.html
Normal file
@@ -0,0 +1,22 @@
|
||||
{{ if or .Site.Params.gcs_engine_id .Site.Params.algolia_docsearch }}
|
||||
<input type="search" class="form-control td-search-input" placeholder=" {{ T "ui_search" }}" aria-label="{{ T "ui_search" }}" autocomplete="off">
|
||||
{{ else if .Site.Params.offlineSearch }}
|
||||
{{ $offlineSearchIndex := resources.Get "json/offline-search-index.json" | resources.ExecuteAsTemplate "offline-search-index.json" . }}
|
||||
{{ $offlineSearchIndexFingerprint := $offlineSearchIndex | resources.Fingerprint "sha512" }}
|
||||
<input
|
||||
type="search"
|
||||
class="form-control td-search-input"
|
||||
placeholder=" {{ T "ui_search" }}"
|
||||
aria-label="{{ T "ui_search" }}"
|
||||
autocomplete="off"
|
||||
{{/*
|
||||
The data attribute name of the json file URL must end with `src` since
|
||||
Hugo's absurlreplacer requires `src`, `href`, `action` or `srcset` suffix for the attribute name.
|
||||
If the absurlreplacer is not applied, the URL will start with `/`.
|
||||
It causes the json file loading error when when relativeURLs is enabled.
|
||||
https://github.com/google/docsy/issues/181
|
||||
*/}}
|
||||
data-offline-search-index-json-src="{{ $offlineSearchIndexFingerprint.RelPermalink }}"
|
||||
data-offline-search-base-href="/"
|
||||
>
|
||||
{{ end }}
|
||||
29
site/themes/docsy/layouts/partials/section-index.html
Normal file
29
site/themes/docsy/layouts/partials/section-index.html
Normal file
@@ -0,0 +1,29 @@
|
||||
<div class="section-index">
|
||||
{{ $pages := (where .Site.Pages "Section" .Section).ByWeight }}
|
||||
{{ $parent := .Page }}
|
||||
{{ if $parent.Params.no_list }}
|
||||
{{/* If no_list is true we don't show a list of subpages */}}
|
||||
{{ else if $parent.Params.simple_list }}
|
||||
{{/* If simple_list is true we show a bulleted list of subpages */}}
|
||||
<ul>
|
||||
{{ range $pages }}
|
||||
{{ if eq .Parent $parent }}
|
||||
<li><a href="{{ .RelPermalink }}">{{- .Title -}}</a></li>
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
</ul>
|
||||
{{ else }}
|
||||
{{/* Otherwise we show a nice formatted list of subpages with page descriptions */}}
|
||||
<hr class="panel-line">
|
||||
{{ range $pages }}
|
||||
{{ if eq .Parent $parent }}
|
||||
<div class="entry">
|
||||
<h5>
|
||||
<a href="{{ .RelPermalink }}">{{- .Title -}}</a>
|
||||
</h5>
|
||||
<p>{{ .Description | markdownify }}</p>
|
||||
</div>
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
</div>
|
||||
47
site/themes/docsy/layouts/partials/sidebar-tree.html
Normal file
47
site/themes/docsy/layouts/partials/sidebar-tree.html
Normal file
@@ -0,0 +1,47 @@
|
||||
{{/* 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 }}
|
||||
{{ template "section-tree-nav-section" (dict "page" . "section" .FirstSection "delayActive" $shouldDelayActive) }}
|
||||
</nav>
|
||||
</div>
|
||||
{{ define "section-tree-nav-section" }}
|
||||
{{ $s := .section }}
|
||||
{{ $p := .page }}
|
||||
{{ $shouldDelayActive := .delayActive }}
|
||||
{{ $active := eq $p.CurrentSection $s }}
|
||||
{{ $show := or (and (not $p.Site.Params.ui.sidebar_menu_compact) ($p.IsAncestor $s)) ($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">{{ $s.LinkTitle }}</a>
|
||||
</li>
|
||||
<ul>
|
||||
<li class="collapse {{ if $show }}show{{ end }}" id="{{ $sid }}">
|
||||
{{ $pages := where (union $s.Pages $s.Sections).ByWeight ".Params.toc_hide" "!=" true }}
|
||||
{{ $pages := $pages | first 50 }}
|
||||
{{ range $pages }}
|
||||
{{ if .IsPage }}
|
||||
{{ $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>
|
||||
{{ else }}
|
||||
{{ template "section-tree-nav-section" (dict "page" $p "section" .) }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
</li>
|
||||
</ul>
|
||||
</ul>
|
||||
{{ end }}
|
||||
14
site/themes/docsy/layouts/partials/sidebar.html
Normal file
14
site/themes/docsy/layouts/partials/sidebar.html
Normal file
@@ -0,0 +1,14 @@
|
||||
{{/* The "active" toggle here may delay rendering, so we only cache this side bar menu for bigger sites. */}}
|
||||
{{ $shouldCache := ge (len .Site.Pages) 2000 }}
|
||||
{{ if $shouldCache }}
|
||||
{{ $mid := printf "m-%s" (.RelPermalink | anchorize) }}
|
||||
<script>
|
||||
$(function() {
|
||||
$("#td-sidebar-menu #{{ $mid }}").toggleClass("active");
|
||||
$("#td-sidebar-menu").toggleClass("d-none");
|
||||
});
|
||||
</script>
|
||||
{{ partialCached "sidebar-tree.html" . .CurrentSection.RelPermalink }}
|
||||
{{ else }}
|
||||
{{ partial "sidebar-tree.html" . }}
|
||||
{{ end }}
|
||||
8
site/themes/docsy/layouts/partials/toc.html
Normal file
8
site/themes/docsy/layouts/partials/toc.html
Normal file
@@ -0,0 +1,8 @@
|
||||
{{ partial "page-meta-links.html" . }}
|
||||
{{ if not .Params.notoc }}
|
||||
{{ with .TableOfContents }}
|
||||
{{ if ge (len .) 200 }}
|
||||
{{ . }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
16
site/themes/docsy/layouts/partials/version-banner.html
Normal file
16
site/themes/docsy/layouts/partials/version-banner.html
Normal file
@@ -0,0 +1,16 @@
|
||||
<!-- Check the variable that indicates whether this is an archived doc set.
|
||||
If yes, display a banner. -->
|
||||
{{ if .Site.Params.archived_version }}
|
||||
{{ $color := "primary" }}
|
||||
{{ $latest_version := .Site.Params.url_latest_version }}
|
||||
{{ $current_version := .Site.Params.version }}
|
||||
<div class="pageinfo pageinfo-{{ $color }}">
|
||||
{{ with $current_version }}<p>Version {{ . | markdownify }} of the
|
||||
documentation is no longer actively maintained. The site that you are
|
||||
currently viewing is an archived snapshot.
|
||||
{{ with $latest_version }}For up-to-date documentation, see the
|
||||
<a href="{{ $latest_version | safeURL }}" target="_blank">latest version</a>.</p>
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
</div>
|
||||
{{ end }}
|
||||
Reference in New Issue
Block a user