From 568553394d0a8b34668a75c9839a0f1f426469b2 Mon Sep 17 00:00:00 2001 From: Dimitri Staessens Date: Sun, 6 Oct 2019 21:10:46 +0200 Subject: theme: Switch to docsy theme --- themes/docsy/layouts/partials/breadcrumb.html | 18 +++++++ themes/docsy/layouts/partials/community_links.html | 29 +++++++++++ themes/docsy/layouts/partials/disqus-comment.html | 23 +++++++++ themes/docsy/layouts/partials/favicons.html | 12 +++++ themes/docsy/layouts/partials/featured-image.html | 14 ++++++ themes/docsy/layouts/partials/feedback.html | 57 ++++++++++++++++++++++ themes/docsy/layouts/partials/footer.html | 39 +++++++++++++++ themes/docsy/layouts/partials/head-css.html | 11 +++++ themes/docsy/layouts/partials/head.html | 26 ++++++++++ themes/docsy/layouts/partials/hooks/body-end.html | 0 themes/docsy/layouts/partials/hooks/head-end.html | 0 .../layouts/partials/navbar-lang-selector.html | 10 ++++ .../layouts/partials/navbar-version-selector.html | 8 +++ themes/docsy/layouts/partials/navbar.html | 33 +++++++++++++ .../docsy/layouts/partials/page-meta-lastmod.html | 1 + themes/docsy/layouts/partials/page-meta-links.html | 24 +++++++++ themes/docsy/layouts/partials/pager.html | 7 +++ themes/docsy/layouts/partials/scripts.html | 14 ++++++ themes/docsy/layouts/partials/search-input.html | 3 ++ themes/docsy/layouts/partials/section-index.html | 29 +++++++++++ themes/docsy/layouts/partials/sidebar-tree.html | 47 ++++++++++++++++++ themes/docsy/layouts/partials/sidebar.html | 14 ++++++ themes/docsy/layouts/partials/toc.html | 8 +++ 23 files changed, 427 insertions(+) create mode 100644 themes/docsy/layouts/partials/breadcrumb.html create mode 100644 themes/docsy/layouts/partials/community_links.html create mode 100644 themes/docsy/layouts/partials/disqus-comment.html create mode 100644 themes/docsy/layouts/partials/favicons.html create mode 100644 themes/docsy/layouts/partials/featured-image.html create mode 100644 themes/docsy/layouts/partials/feedback.html create mode 100644 themes/docsy/layouts/partials/footer.html create mode 100644 themes/docsy/layouts/partials/head-css.html create mode 100644 themes/docsy/layouts/partials/head.html create mode 100644 themes/docsy/layouts/partials/hooks/body-end.html create mode 100644 themes/docsy/layouts/partials/hooks/head-end.html create mode 100644 themes/docsy/layouts/partials/navbar-lang-selector.html create mode 100644 themes/docsy/layouts/partials/navbar-version-selector.html create mode 100644 themes/docsy/layouts/partials/navbar.html create mode 100644 themes/docsy/layouts/partials/page-meta-lastmod.html create mode 100644 themes/docsy/layouts/partials/page-meta-links.html create mode 100644 themes/docsy/layouts/partials/pager.html create mode 100644 themes/docsy/layouts/partials/scripts.html create mode 100644 themes/docsy/layouts/partials/search-input.html create mode 100644 themes/docsy/layouts/partials/section-index.html create mode 100644 themes/docsy/layouts/partials/sidebar-tree.html create mode 100644 themes/docsy/layouts/partials/sidebar.html create mode 100644 themes/docsy/layouts/partials/toc.html (limited to 'themes/docsy/layouts/partials') diff --git a/themes/docsy/layouts/partials/breadcrumb.html b/themes/docsy/layouts/partials/breadcrumb.html new file mode 100644 index 0000000..0403f6a --- /dev/null +++ b/themes/docsy/layouts/partials/breadcrumb.html @@ -0,0 +1,18 @@ + +{{ 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 }} + +{{ 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 0000000..48d6458 --- /dev/null +++ b/themes/docsy/layouts/partials/community_links.html @@ -0,0 +1,29 @@ +{{ $links := .Site.Params.links }} + + + +{{ define "community-links-list" }} + +{{ end }} diff --git a/themes/docsy/layouts/partials/disqus-comment.html b/themes/docsy/layouts/partials/disqus-comment.html new file mode 100644 index 0000000..c3ae3f9 --- /dev/null +++ b/themes/docsy/layouts/partials/disqus-comment.html @@ -0,0 +1,23 @@ +
+ +
+ + +
diff --git a/themes/docsy/layouts/partials/favicons.html b/themes/docsy/layouts/partials/favicons.html new file mode 100644 index 0000000..43e5c90 --- /dev/null +++ b/themes/docsy/layouts/partials/favicons.html @@ -0,0 +1,12 @@ + + + + + + + + + + + + diff --git a/themes/docsy/layouts/partials/featured-image.html b/themes/docsy/layouts/partials/featured-image.html new file mode 100644 index 0000000..5756999 --- /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 ) }} +
+Featured Image for {{ $p.Title }} +{{ with $image.Params.byline }} +
{{ . | html }}
+{{ end }} +
+{{ 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 0000000..0978321 --- /dev/null +++ b/themes/docsy/layouts/partials/feedback.html @@ -0,0 +1,57 @@ + +

Feedback

+

Was this page helpful?

+ + +

+ {{ .yes | safeHTML }} +

+

+ {{ .no | safeHTML }} +

+ diff --git a/themes/docsy/layouts/partials/footer.html b/themes/docsy/layouts/partials/footer.html new file mode 100644 index 0000000..dfb1f64 --- /dev/null +++ b/themes/docsy/layouts/partials/footer.html @@ -0,0 +1,39 @@ +{{ $links := .Site.Params.links }} + +{{ define "footer-links-block" }} + +{{ end }} diff --git a/themes/docsy/layouts/partials/head-css.html b/themes/docsy/layouts/partials/head-css.html new file mode 100644 index 0000000..603da38 --- /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) }} + +{{ else }} +{{ $css := resources.Get $scssMain | toCSS (dict "enableSourceMap" false) | postCSS | minify | fingerprint }} + + +{{ 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 0000000..b4b707f --- /dev/null +++ b/themes/docsy/layouts/partials/head.html @@ -0,0 +1,26 @@ + + +{{ hugo.Generator }} +{{ if eq (getenv "HUGO_ENV") "production" }} + +{{ else }} + +{{ end }} +{{ range .AlternativeOutputFormats -}} + +{{ end -}} +{{ partialCached "favicons.html" . }} +{{ if .IsHome }}{{ .Site.Title }}{{ else }}{{ with .Title }}{{ . }} | {{ end }}{{ .Site.Title }}{{ end }} +{{- template "_internal/opengraph.html" . -}} +{{- template "_internal/google_news.html" . -}} +{{- template "_internal/schema.html" . -}} +{{- template "_internal/twitter_cards.html" . -}} +{{ if eq (getenv "HUGO_ENV") "production" }} +{{ partial "matomo/analytics.html" . }} +{{ end }} +{{ partialCached "head-css.html" . "asdf" }} + +{{ partial "hooks/head-end.html" . }} 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 0000000..e69de29 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 0000000..e69de29 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 0000000..dc59294 --- /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 }} + + \ No newline at end of file diff --git a/themes/docsy/layouts/partials/navbar-version-selector.html b/themes/docsy/layouts/partials/navbar-version-selector.html new file mode 100644 index 0000000..6ac1ef6 --- /dev/null +++ b/themes/docsy/layouts/partials/navbar-version-selector.html @@ -0,0 +1,8 @@ + + diff --git a/themes/docsy/layouts/partials/navbar.html b/themes/docsy/layouts/partials/navbar.html new file mode 100644 index 0000000..284283b --- /dev/null +++ b/themes/docsy/layouts/partials/navbar.html @@ -0,0 +1,33 @@ +{{ $cover := .HasShortcode "blocks/cover" }} + 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 0000000..b24e62d --- /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 }}: {{ .Subject }} ({{ .AbbreviatedHash }}){{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 0000000..8e2650f --- /dev/null +++ b/themes/docsy/layouts/partials/page-meta-links.html @@ -0,0 +1,24 @@ +{{ if .Path }} +{{ $gh_repo := ($.Param "github_repo") }} +{{ $gh_subdir := ($.Param "github_subdir") }} +{{ $gh_project_repo := ($.Param "github_project_repo") }} +{{ if $gh_repo }} +
+{{ $editURL := printf "%s/edit/master/content/%s" $gh_repo .Path }} +{{ if and ($gh_subdir) (.Site.Language.Lang) }} +{{ $editURL = printf "%s/edit/master/%s/content/%s/%s" $gh_repo $gh_subdir ($.Site.Language.Lang) $.Path }} +{{ else if .Site.Language.Lang }} +{{ $editURL = printf "%s/edit/master/content/%s/%s" $gh_repo ($.Site.Language.Lang) .Path }} +{{ else if $gh_subdir }} +{{ $editURL = printf "%s/edit/master/%s/content/%s" $gh_repo $gh_subdir $.Path }} +{{ end }} +{{ $issuesURL := printf "%s/issues/new?title=%s" $gh_repo (htmlEscape $.Title )}} + {{ T "post_edit_this" }} + {{ T "post_create_issue" }} +{{ if $gh_project_repo }} +{{ $project_issueURL := printf "%s/issues/new" $gh_project_repo }} + {{ T "post_create_project_issue" }} +{{ end }} +
+{{ end }} +{{ end }} diff --git a/themes/docsy/layouts/partials/pager.html b/themes/docsy/layouts/partials/pager.html new file mode 100644 index 0000000..fd547c5 --- /dev/null +++ b/themes/docsy/layouts/partials/pager.html @@ -0,0 +1,7 @@ + diff --git a/themes/docsy/layouts/partials/scripts.html b/themes/docsy/layouts/partials/scripts.html new file mode 100644 index 0000000..cc8dc07 --- /dev/null +++ b/themes/docsy/layouts/partials/scripts.html @@ -0,0 +1,14 @@ + + + +{{ $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 }} +{{ $js := (slice $jsBase $jsAnchor $jsSearch) | resources.Concat "js/main.js" }} +{{ if .Site.IsServer }} + +{{ else }} +{{ $js := $js | minify | fingerprint }} + +{{ 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 0000000..883ca3c --- /dev/null +++ b/themes/docsy/layouts/partials/search-input.html @@ -0,0 +1,3 @@ +{{ with .Site.Params.gcs_engine_id }} + +{{ end }} \ No newline at end of file diff --git a/themes/docsy/layouts/partials/section-index.html b/themes/docsy/layouts/partials/section-index.html new file mode 100644 index 0000000..987f0a2 --- /dev/null +++ b/themes/docsy/layouts/partials/section-index.html @@ -0,0 +1,29 @@ +
+ {{ $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 */}} + + {{ else }} + {{/* Otherwise we show a nice formatted list of subpages with page descriptions */}} +
+ {{ range $pages }} + {{ if eq .Parent $parent }} +
+
+ {{- .Title -}} +
+

{{ .Description }}

+
+ {{ end }} + {{ end }} + {{ end }} +
diff --git a/themes/docsy/layouts/partials/sidebar-tree.html b/themes/docsy/layouts/partials/sidebar-tree.html new file mode 100644 index 0000000..a3eeb2a --- /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 }} +
+ {{ if not .Site.Params.ui.sidebar_search_disable }} + + {{ end }} + +
+{{ 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 }} + +{{ end }} diff --git a/themes/docsy/layouts/partials/sidebar.html b/themes/docsy/layouts/partials/sidebar.html new file mode 100644 index 0000000..bf568e2 --- /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) }} + +{{ 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 0000000..f155f8b --- /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 -- cgit v1.2.3