diff options
Diffstat (limited to 'themes/docsy/layouts')
44 files changed, 741 insertions, 0 deletions
diff --git a/themes/docsy/layouts/_default/baseof.html b/themes/docsy/layouts/_default/baseof.html new file mode 100644 index 000000000..5767a951f --- /dev/null +++ b/themes/docsy/layouts/_default/baseof.html @@ -0,0 +1,18 @@ +<!doctype html> +<html lang="{{ .Site.Language.Lang }}" class="no-js"> + <head> + {{ partial "head.html" . }} + </head> + <body class="td-{{ .Kind }}"> + <header> + {{ partial "navbar.html" . }} + </header> + <div class="container-fluid td-default td-outer"> + <main role="main" class="td-main"> + {{ block "main" . }}{{ end }} + </main> + {{ partial "footer.html" . }} + </div> + {{ partialCached "scripts.html" . }} + </body> +</html>
\ No newline at end of file diff --git a/themes/docsy/layouts/_default/content.html b/themes/docsy/layouts/_default/content.html new file mode 100644 index 000000000..b574ad29c --- /dev/null +++ b/themes/docsy/layouts/_default/content.html @@ -0,0 +1,14 @@ +<div class="td-content"> + <h1>{{ .Title }}</h1> + {{ with .Params.description }}<div class="lead">{{ . | markdownify }}</div>{{ end }} + {{ .Content }} + {{ if (and (not .Params.hide_feedback) (.Site.Params.ui.feedback.enable) (.Site.GoogleAnalytics)) }} + {{ partial "feedback.html" .Site.Params.ui.feedback }} + <br /> + {{ end }} + {{ if (.Site.DisqusShortname) }} + <br /> + {{ partial "disqus-comment.html" . }} + {{ end }} + <div class="text-muted mt-5 pt-3 border-top">{{ partial "page-meta-lastmod.html" . }}</div> +</div> diff --git a/themes/docsy/layouts/_default/list.html b/themes/docsy/layouts/_default/list.html new file mode 100644 index 000000000..b2e137af6 --- /dev/null +++ b/themes/docsy/layouts/_default/list.html @@ -0,0 +1,5 @@ +{{ define "main" }} +{{ with .Content }} +{{ . }} +{{ end }} +{{ end }}
\ No newline at end of file diff --git a/themes/docsy/layouts/_default/list.rss.xml b/themes/docsy/layouts/_default/list.rss.xml new file mode 100644 index 000000000..ae4f908ae --- /dev/null +++ b/themes/docsy/layouts/_default/list.rss.xml @@ -0,0 +1,48 @@ +<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"> + <channel> + <title>{{ .Site.Title }} – {{ .Title }}</title> + <link>{{ .Permalink }}</link> + <description>Recent Hugo news from gohugo.io</description> + <generator>Hugo -- gohugo.io</generator>{{ with .Site.LanguageCode }} + <language>{{.}}</language>{{end}}{{ with .Site.Author.email }} + <managingEditor>{{.}}{{ with $.Site.Author.name }} ({{.}}){{end}}</managingEditor>{{end}}{{ with .Site.Author.email }} + <webMaster>{{.}}{{ with $.Site.Author.name }} ({{.}}){{end}}</webMaster>{{end}}{{ with .Site.Copyright }} + <copyright>{{.}}</copyright>{{end}}{{ if not .Date.IsZero }} + <lastBuildDate>{{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</lastBuildDate>{{ end }} + <image> + <url>{{ "img/hugo.png" | absURL }}</url> + <title>GoHugo.io</title> + <link>{{ .Permalink }}</link> + </image> + {{ with .OutputFormats.Get "RSS" }} + {{ printf "<atom:link href=%q rel=\"self\" type=%q />" .Permalink .MediaType | safeHTML }} + {{ end }} + {{ if not $.Section }} + {{ $sections := .Site.Params.rss_sections | default (slice "blog") }} + {{ .Scratch.Set "rss_pages" (first 50 (where $.Site.RegularPages "Type" "in" $sections )) }} + {{ else }} + {{ if $.Parent.IsHome }} + {{ .Scratch.Set "rss_pages" (first 50 (where $.Site.RegularPages "Type" $.Section )) }} + {{ else }} + {{ .Scratch.Set "rss_pages" (first 50 $.Pages) }} + {{ end }} + {{ end }} + {{ range (.Scratch.Get "rss_pages") }} + <item> + <title>{{ .Section | title }}: {{ .Title }}</title> + <link>{{ .Permalink }}</link> + <pubDate>{{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</pubDate> + {{ with .Site.Author.email }}<author>{{.}}{{ with $.Site.Author.name }} ({{.}}){{end}}</author>{{end}} + <guid>{{ .Permalink }}</guid> + <description> + {{ $img := (.Resources.ByType "image").GetMatch "*featured*" }} + {{ with $img }} + {{ $img := .Resize "640x" }} + {{ printf "<![CDATA[<img src=\"%s\" width=\"%d\" height=\"%d\"/>]]>" $img.Permalink $img.Width $img.Height | safeHTML }} + {{ end }} + {{ .Content | html }} + </description> + </item> + {{ end }} + </channel> +</rss>
\ No newline at end of file diff --git a/themes/docsy/layouts/_default/search.html b/themes/docsy/layouts/_default/search.html new file mode 100644 index 000000000..395c398df --- /dev/null +++ b/themes/docsy/layouts/_default/search.html @@ -0,0 +1,22 @@ +{{ define "main" }} +<section class="row td-search-result"> +<div class="col-12 col-md-8 offset-md-2"> +<h2 class="ml-4">{{ .Title }}</h2> +{{ with .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> +{{ end }} +</div> +</section> + +{{ end }}
\ No newline at end of file diff --git a/themes/docsy/layouts/_default/single.html b/themes/docsy/layouts/_default/single.html new file mode 100644 index 000000000..b2e137af6 --- /dev/null +++ b/themes/docsy/layouts/_default/single.html @@ -0,0 +1,5 @@ +{{ define "main" }} +{{ with .Content }} +{{ . }} +{{ end }} +{{ end }}
\ No newline at end of file diff --git a/themes/docsy/layouts/blog/baseof.html b/themes/docsy/layouts/blog/baseof.html new file mode 100644 index 000000000..e679ff75f --- /dev/null +++ b/themes/docsy/layouts/blog/baseof.html @@ -0,0 +1,34 @@ +<!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 }} td-blog"> + <header> + {{ partial "navbar.html" . }} + </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 "sidebar.html" . }} + </div> + <div class="d-none d-xl-block col-xl-2 td-toc d-print-none"> + {{ partial "toc.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> + </div> + {{ partial "footer.html" . }} + </div> + {{ partial "scripts.html" . }} + </body> +</html>
\ No newline at end of file diff --git a/themes/docsy/layouts/blog/content.html b/themes/docsy/layouts/blog/content.html new file mode 100644 index 000000000..7193b191d --- /dev/null +++ b/themes/docsy/layouts/blog/content.html @@ -0,0 +1,16 @@ +<div class="td-content"> + <h1>{{ .Title }}</h1> + {{ with .Params.description }}<div class="lead">{{ . | markdownify }}</div>{{ end }} + <div class="td-byline mb-4"> + {{ with .Params.author }}{{ T "post_byline_by" }} <b>{{ . | markdownify }}</b> |{{ end}} + <time datetime="{{ $.Date.Format "2006-01-02" }}" class="text-muted">{{ $.Date.Format $.Site.Params.time_format_blog }}</time> + </div> + {{ .Content }} + {{ if (.Site.DisqusShortname) }} + <br /> + {{ partial "disqus-comment.html" . }} + <br /> + {{ end }} + + {{ partial "pager.html" . }} +</div> diff --git a/themes/docsy/layouts/blog/list.html b/themes/docsy/layouts/blog/list.html new file mode 100644 index 000000000..1480cfcdd --- /dev/null +++ b/themes/docsy/layouts/blog/list.html @@ -0,0 +1,36 @@ +{{ define "main" }} +{{ if .Parent.IsHome }} +{{ $.Scratch.Set "blog-pages" (where .Site.RegularPages "Section" .Section) }} +{{ else }} +{{$.Scratch.Set "blog-pages" .Pages }} +{{ end }} +{{ $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 }}
\ No newline at end of file diff --git a/themes/docsy/layouts/blog/single.html b/themes/docsy/layouts/blog/single.html new file mode 100644 index 000000000..00cb3ab91 --- /dev/null +++ b/themes/docsy/layouts/blog/single.html @@ -0,0 +1,3 @@ +{{ define "main" }} +{{ .Render "content" }} +{{ end }}
\ No newline at end of file diff --git a/themes/docsy/layouts/community/list.html b/themes/docsy/layouts/community/list.html new file mode 100644 index 000000000..d66a50ed6 --- /dev/null +++ b/themes/docsy/layouts/community/list.html @@ -0,0 +1,19 @@ +{{ define "main" }} + +<a class="td-offset-anchor"></a> +<section class="row td-box td-box--1 position-relative td-box--gradient td-box--height-auto"> + <div class="container text-center td-arrow-down"> + <span class="h4 mb-0"> +<h1>Join the {{ .Site.Title }} community</h1> + +<p>{{ .Site.Title }} is an open source project that anyone in the community can use, improve, and enjoy. We'd love you to join us! Here's a few ways to find out what's happening and get involved. +</span> + </div> +</section> +{{ partial "community_links.html" . }} + +<div class="td-content"> +{{ .Content }} +</div> + +{{ end }} diff --git a/themes/docsy/layouts/docs/baseof.html b/themes/docsy/layouts/docs/baseof.html new file mode 100644 index 000000000..108ea7a41 --- /dev/null +++ b/themes/docsy/layouts/docs/baseof.html @@ -0,0 +1,30 @@ +<!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" . }} + </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 "sidebar.html" . }} + </div> + <div class="d-none d-xl-block col-xl-2 td-toc d-print-none"> + {{ partial "toc.html" . }} + </div> + <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 }} + </main> + </div> + </div> + {{ partial "footer.html" . }} + </div> + {{ partial "scripts.html" . }} + </body> +</html>
\ No newline at end of file diff --git a/themes/docsy/layouts/docs/list.html b/themes/docsy/layouts/docs/list.html new file mode 100644 index 000000000..00cb3ab91 --- /dev/null +++ b/themes/docsy/layouts/docs/list.html @@ -0,0 +1,3 @@ +{{ define "main" }} +{{ .Render "content" }} +{{ end }}
\ No newline at end of file diff --git a/themes/docsy/layouts/docs/single.html b/themes/docsy/layouts/docs/single.html new file mode 100644 index 000000000..00cb3ab91 --- /dev/null +++ b/themes/docsy/layouts/docs/single.html @@ -0,0 +1,3 @@ +{{ define "main" }} +{{ .Render "content" }} +{{ end }}
\ No newline at end of file diff --git a/themes/docsy/layouts/home.html b/themes/docsy/layouts/home.html new file mode 100644 index 000000000..b2e137af6 --- /dev/null +++ b/themes/docsy/layouts/home.html @@ -0,0 +1,5 @@ +{{ define "main" }} +{{ with .Content }} +{{ . }} +{{ end }} +{{ end }}
\ No newline at end of file diff --git a/themes/docsy/layouts/partials/breadcrumb.html b/themes/docsy/layouts/partials/breadcrumb.html new file mode 100644 index 000000000..0403f6a56 --- /dev/null +++ b/themes/docsy/layouts/partials/breadcrumb.html @@ -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 }}
\ No newline at end of file diff --git a/themes/docsy/layouts/partials/community_links.html b/themes/docsy/layouts/partials/community_links.html new file mode 100644 index 000000000..c61c67e35 --- /dev/null +++ b/themes/docsy/layouts/partials/community_links.html @@ -0,0 +1,29 @@ +{{ $links := .Site.Params.links }} + +<section class="row td-box td-box--4 td-box--gradient td-box--height-auto"> +<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 }} diff --git a/themes/docsy/layouts/partials/disqus-comment.html b/themes/docsy/layouts/partials/disqus-comment.html new file mode 100644 index 000000000..c3ae3f91b --- /dev/null +++ b/themes/docsy/layouts/partials/disqus-comment.html @@ -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> diff --git a/themes/docsy/layouts/partials/favicons.html b/themes/docsy/layouts/partials/favicons.html new file mode 100644 index 000000000..43e5c9032 --- /dev/null +++ b/themes/docsy/layouts/partials/favicons.html @@ -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-96x196.png" | relURL }}" sizes="96x196"> +<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"> diff --git a/themes/docsy/layouts/partials/featured-image.html b/themes/docsy/layouts/partials/featured-image.html new file mode 100644 index 000000000..5756999db --- /dev/null +++ b/themes/docsy/layouts/partials/featured-image.html @@ -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 }}
\ No newline at end of file diff --git a/themes/docsy/layouts/partials/feedback.html b/themes/docsy/layouts/partials/feedback.html new file mode 100644 index 000000000..097832190 --- /dev/null +++ b/themes/docsy/layouts/partials/feedback.html @@ -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> diff --git a/themes/docsy/layouts/partials/footer.html b/themes/docsy/layouts/partials/footer.html new file mode 100644 index 000000000..d05eeb48a --- /dev/null +++ b/themes/docsy/layouts/partials/footer.html @@ -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="{{ . }}">{{ 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 }}"> + <a class="text-white" target="_blank" href="{{ .url }}"> + <i class="{{ .icon }}"></i> + </a> + </li> + {{ end }} +</ul> +{{ end }} diff --git a/themes/docsy/layouts/partials/head-css.html b/themes/docsy/layouts/partials/head-css.html new file mode 100644 index 000000000..603da3861 --- /dev/null +++ b/themes/docsy/layouts/partials/head-css.html @@ -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 }}
\ No newline at end of file diff --git a/themes/docsy/layouts/partials/head.html b/themes/docsy/layouts/partials/head.html new file mode 100644 index 000000000..cb0375720 --- /dev/null +++ b/themes/docsy/layouts/partials/head.html @@ -0,0 +1,26 @@ +<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> +{{ partial "hooks/head-end.html" . }}
\ No newline at end of file diff --git a/themes/docsy/layouts/partials/hooks/body-end.html b/themes/docsy/layouts/partials/hooks/body-end.html new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/themes/docsy/layouts/partials/hooks/body-end.html diff --git a/themes/docsy/layouts/partials/hooks/head-end.html b/themes/docsy/layouts/partials/hooks/head-end.html new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/themes/docsy/layouts/partials/hooks/head-end.html diff --git a/themes/docsy/layouts/partials/navbar-lang-selector.html b/themes/docsy/layouts/partials/navbar-lang-selector.html new file mode 100644 index 000000000..dc592947f --- /dev/null +++ b/themes/docsy/layouts/partials/navbar-lang-selector.html @@ -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>
\ No newline at end of file diff --git a/themes/docsy/layouts/partials/navbar.html b/themes/docsy/layouts/partials/navbar.html new file mode 100644 index 000000000..5ed33d097 --- /dev/null +++ b/themes/docsy/layouts/partials/navbar.html @@ -0,0 +1,26 @@ +{{ $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">{{ with resources.Get "icons/logo.svg" }}{{ ( . | minify).Content | safeHTML }} {{ 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 }} + <a class="nav-link{{if $active }} active{{end}}" href="{{ with .Page }}{{ .RelPermalink }}{{ else }}{{ .URL | relLangURL }}{{ end }}"><span{{if $active }} class="active"{{end}}>{{ .Name }}</span></a> + </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> diff --git a/themes/docsy/layouts/partials/page-meta-lastmod.html b/themes/docsy/layouts/partials/page-meta-lastmod.html new file mode 100644 index 000000000..b24e62d1f --- /dev/null +++ b/themes/docsy/layouts/partials/page-meta-lastmod.html @@ -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 }} diff --git a/themes/docsy/layouts/partials/page-meta-links.html b/themes/docsy/layouts/partials/page-meta-links.html new file mode 100644 index 000000000..b8e0925b5 --- /dev/null +++ b/themes/docsy/layouts/partials/page-meta-links.html @@ -0,0 +1,11 @@ +{{ if .Path }} +{{ $gh_repo := ($.Param "github_repo") }} +{{ if $gh_repo }} +<div class="td-page-meta ml-2 pb-1 pt-2 mb-0"> +{{ $editURL := printf "%s/edit/master/content/%s/%s" $gh_repo ($.Site.Language.Lang) .Path }} +{{ $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> +</div> +{{ end }} +{{ end }} diff --git a/themes/docsy/layouts/partials/pager.html b/themes/docsy/layouts/partials/pager.html new file mode 100644 index 000000000..fd547c5dc --- /dev/null +++ b/themes/docsy/layouts/partials/pager.html @@ -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> diff --git a/themes/docsy/layouts/partials/scripts.html b/themes/docsy/layouts/partials/scripts.html new file mode 100644 index 000000000..7267b3393 --- /dev/null +++ b/themes/docsy/layouts/partials/scripts.html @@ -0,0 +1,13 @@ + +<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" }} +{{ $jsSearch := resources.Get "js/search.js" | resources.ExecuteAsTemplate "js/search.js" .Site.Home }} +{{ $js := (slice $jsBase $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 }}"></script> +{{ end }} +{{ partial "hooks/body-end.html" . }} diff --git a/themes/docsy/layouts/partials/search-input.html b/themes/docsy/layouts/partials/search-input.html new file mode 100644 index 000000000..883ca3c3a --- /dev/null +++ b/themes/docsy/layouts/partials/search-input.html @@ -0,0 +1,3 @@ +{{ with .Site.Params.gcs_engine_id }} + <input type="search" class="form-control td-search-input" placeholder=" {{ T "ui_search" }}" aria-label="{{ T "ui_search" }}" autocomplete="off"> +{{ end }}
\ No newline at end of file diff --git a/themes/docsy/layouts/partials/sidebar-tree.html b/themes/docsy/layouts/partials/sidebar-tree.html new file mode 100644 index 000000000..a3eeb2a45 --- /dev/null +++ b/themes/docsy/layouts/partials/sidebar-tree.html @@ -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 }} diff --git a/themes/docsy/layouts/partials/sidebar.html b/themes/docsy/layouts/partials/sidebar.html new file mode 100644 index 000000000..bf568e210 --- /dev/null +++ b/themes/docsy/layouts/partials/sidebar.html @@ -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 }} diff --git a/themes/docsy/layouts/partials/toc.html b/themes/docsy/layouts/partials/toc.html new file mode 100644 index 000000000..f155f8b13 --- /dev/null +++ b/themes/docsy/layouts/partials/toc.html @@ -0,0 +1,8 @@ +{{ partial "page-meta-links.html" . }} +{{ if not .Params.notoc }} +{{ with .TableOfContents }} +{{ if ge (len .) 200 }} +{{ . }} +{{ end }} +{{ end }} +{{ end }}
\ No newline at end of file diff --git a/themes/docsy/layouts/shortcodes/alert.html b/themes/docsy/layouts/shortcodes/alert.html new file mode 100644 index 000000000..a95d8b2f8 --- /dev/null +++ b/themes/docsy/layouts/shortcodes/alert.html @@ -0,0 +1,5 @@ +{{ $color := .Get "color" | default "primary" }} +<div class="alert alert-{{ $color }}" role="alert"> +{{ with .Get "title" }}<h4 class="alert-heading">{{ . | safeHTML }}</h4>{{ end }} +{{ .Inner }} +</div>
\ No newline at end of file diff --git a/themes/docsy/layouts/shortcodes/blocks/cover.html b/themes/docsy/layouts/shortcodes/blocks/cover.html new file mode 100644 index 000000000..b9afb0408 --- /dev/null +++ b/themes/docsy/layouts/shortcodes/blocks/cover.html @@ -0,0 +1,39 @@ +{{ $blockID := printf "td-cover-block-%d" .Ordinal }} +{{ $promo_image := (.Page.Resources.ByType "image").GetMatch "**background*" }} +{{ $logo_image := (.Page.Resources.ByType "image").GetMatch "**logo*" }} +{{ $col_id := .Get "color" | default "dark" }} +{{ $image_anchor := .Get "image_anchor" | default "smart" }} +{{ $logo_anchor := .Get "logo_anchor" | default "smart" }} +{{/* Height can be one of: auto, min, med, max, full. */}} +{{ $height := .Get "height" | default "max" }} +{{ with $promo_image }} +{{ $promo_image_big := (.Fill (printf "1920x1080 %s" $image_anchor)) }} +{{ $promo_image_small := (.Fill (printf "960x540 %s" $image_anchor)) }} +<link rel="preload" as="image" href="{{ $promo_image_small.RelPermalink }}" media="(max-width: 1200px)"> +<link rel="preload" as="image" href="{{ $promo_image_big.RelPermalink }}" media="(min-width: 1200px)"> +<style> +#{{ $blockID }} { + background-image: url({{ $promo_image_small.RelPermalink }}); +} +@media only screen and (min-width: 1200px) { + #{{ $blockID }} { + background-image: url({{ $promo_image_big.RelPermalink }}); + } +} +</style> +{{ end }} +<section id="{{ $blockID }}" class="row td-cover-block td-cover-block--height-{{ $height }} js-td-cover td-overlay td-overlay--dark -bg-{{ $col_id }}"> + <div class="container td-overlay__inner"> + <div class="row"> + <div class="col-12"> + <div class="text-center"> + {{ with .Get "title" }}<h1 class="display-1 mt-0 mt-md-5 pb-4">{{ $title := . }}{{ with $logo_image }}{{ $logo_image_resized := (.Fit (printf "70x70 %s" $logo_anchor)) }}<img class="td-cover-logo" src="{{ $logo_image_resized.RelPermalink }}" alt="{{ $title | html }} Logo">{{ end }}{{ $title | html }}</h1>{{ end }} + {{ with .Get "subtitle" }}<p class="display-2 text-uppercase mb-0">{{ . | html }}</p>{{ end }} + <div class="pt-3 lead"> + {{ .Inner }} + </div> + </div> + </div> + </div> + </div> +</section> diff --git a/themes/docsy/layouts/shortcodes/blocks/feature.html b/themes/docsy/layouts/shortcodes/blocks/feature.html new file mode 100644 index 000000000..d734dfb66 --- /dev/null +++ b/themes/docsy/layouts/shortcodes/blocks/feature.html @@ -0,0 +1,10 @@ +{{ $icon := .Get "icon" | default "fa-lightbulb" }} +{{ $url_text := .Get "url_text" }} +<div class="col-lg-4 mb-5 mb-lg-0 text-center "> + <div class="mb-4 h1"> + <i class="{{ if not (or (hasPrefix $icon "fas ") (hasPrefix $icon "fab ")) }}fas {{ end }}{{ $icon }}"></i> + </div> + <h4 class="h3">{{ .Get "title" | markdownify }}</h4> + <p class="mb-0">{{ .Inner }}</p> + {{ with .Get "url" }}<p><a href="{{ . }}">{{ with $url_text }}{{ $url_text }}{{ else }}{{ T "ui_read_more" }}{{ end }} …</a></p>{{ end }} +</div> diff --git a/themes/docsy/layouts/shortcodes/blocks/lead.html b/themes/docsy/layouts/shortcodes/blocks/lead.html new file mode 100644 index 000000000..a0c302214 --- /dev/null +++ b/themes/docsy/layouts/shortcodes/blocks/lead.html @@ -0,0 +1,11 @@ +{{ $col_id := .Get "color" | default .Ordinal }} +{{ $height := .Get "height" | default "auto" }} +{{/* Height can be one of: auto, min, med, max, full. */}} +<a id="td-block-{{ .Ordinal }}" class="td-offset-anchor"></a> +<section class="row td-box td-box--{{ $col_id }} position-relative td-box--gradient td-box--height-{{ $height }}"> + <div class="container text-center td-arrow-down"> + <span class="h4 mb-0"> + {{ .Inner }} + </span> + </div> +</section>
\ No newline at end of file diff --git a/themes/docsy/layouts/shortcodes/blocks/link-down.html b/themes/docsy/layouts/shortcodes/blocks/link-down.html new file mode 100644 index 000000000..639586633 --- /dev/null +++ b/themes/docsy/layouts/shortcodes/blocks/link-down.html @@ -0,0 +1,7 @@ +{{ with .Parent }} +{{ $id := $.Get "id" | default (printf "td-block-%d" ( add .Ordinal 1 )) }} +{{ $color := $.Get "color" | default "blue" }} +<a class="btn btn-link text-{{ $color }}" href="#{{ $id }}"><i class="fa fa-chevron-circle-down" style="font-size: 400%"></i></a> +{{ else }} +{{ errorf "The link-down shortcode is supposed to be nested inside a shortcode"}} +{{ end }}
\ No newline at end of file diff --git a/themes/docsy/layouts/shortcodes/blocks/section.html b/themes/docsy/layouts/shortcodes/blocks/section.html new file mode 100644 index 000000000..bbd4e1723 --- /dev/null +++ b/themes/docsy/layouts/shortcodes/blocks/section.html @@ -0,0 +1,10 @@ +{{ $col_id := .Get "color" | default .Ordinal }} +{{ $height := .Get "height" | default "auto" }} +<a id="td-block-{{ .Ordinal }}" class="td-offset-anchor"></a> +<section class="row td-box td-box--{{ $col_id }} td-box--gradient td-box--height-{{ $height }}"> + <div class="col"> + <div class="row"> + {{ .Inner }} + </div> + </div> +</section>
\ No newline at end of file diff --git a/themes/docsy/layouts/shortcodes/imgproc.html b/themes/docsy/layouts/shortcodes/imgproc.html new file mode 100644 index 000000000..bb80a8502 --- /dev/null +++ b/themes/docsy/layouts/shortcodes/imgproc.html @@ -0,0 +1,21 @@ +{{ $original := .Page.Resources.GetMatch (printf "**%s*" (.Get 0)) }} +{{ $command := .Get 1 }} +{{ $options := .Get 2 }} +{{ if eq $command "Fit"}} +{{ .Scratch.Set "image" ($original.Fit $options) }} +{{ else if eq $command "Resize"}} +{{ .Scratch.Set "image" ($original.Resize $options) }} +{{ else if eq $command "Fill"}} +{{ .Scratch.Set "image" ($original.Fill $options) }} +{{ else }} +{{ errorf "Invalid image processing command: Must be one of Fit, Fill or Resize."}} +{{ end }} +{{ $image := .Scratch.Get "image" }} +<div class="card rounded p-2 td-post-card mb-4 mt-4" style="max-width: {{ add $image.Width 10 }}px"> + <img class="card-img-top" src="{{ $image.RelPermalink }}" width="{{ $image.Width }}" height="{{ $image.Height }}"> + {{ with .Inner }} + <div class="card-body px-0 pt-2 pb-0"> + <p class="card-text">{{ . }}{{ with $image.Params.byline }}<small class="text-muted"><br/>{{ . | html }}</small>{{ end }}</p> + </div> + {{ end }} +</div>
\ No newline at end of file diff --git a/themes/docsy/layouts/shortcodes/readfile.md b/themes/docsy/layouts/shortcodes/readfile.md new file mode 100644 index 000000000..117c7e870 --- /dev/null +++ b/themes/docsy/layouts/shortcodes/readfile.md @@ -0,0 +1,8 @@ +{{$file := .Get "file"}} +{{- if eq (.Get "markdown") "true" -}} +{{- $file | readFile | markdownify -}} +{{- else if (.Get "highlight") -}} +{{- highlight ($file | readFile) (.Get "highlight") "" -}} +{{- else -}} +{{ $file | readFile | safeHTML }} +{{- end -}} |