summaryrefslogtreecommitdiff
path: root/themes/hugo-book/layouts/_partials
diff options
context:
space:
mode:
authoraethrvmn <me@aethrvmn.gr>2025-09-20 22:27:35 +0000
committeraethrvmn <me@aethrvmn.gr>2025-09-20 22:27:35 +0000
commit9b5f3fad7068298265dbbc8a65077f7917a090a5 (patch)
tree0905b29eb7c03d6bc6e16dd1ebcd1ec9b6b83320 /themes/hugo-book/layouts/_partials
parentsuper simple setup guide (diff)
updated hugo-book theme
Diffstat (limited to 'themes/hugo-book/layouts/_partials')
-rw-r--r--themes/hugo-book/layouts/_partials/docs/brand.html8
-rw-r--r--themes/hugo-book/layouts/_partials/docs/comments.html2
-rw-r--r--themes/hugo-book/layouts/_partials/docs/date.html6
-rw-r--r--themes/hugo-book/layouts/_partials/docs/footer.html29
-rw-r--r--themes/hugo-book/layouts/_partials/docs/header.html13
-rw-r--r--themes/hugo-book/layouts/_partials/docs/html-head-favicon.html1
-rw-r--r--themes/hugo-book/layouts/_partials/docs/html-head-title.html1
-rw-r--r--themes/hugo-book/layouts/_partials/docs/html-head.html56
-rw-r--r--themes/hugo-book/layouts/_partials/docs/inject/body.html0
-rw-r--r--themes/hugo-book/layouts/_partials/docs/inject/content-after.html0
-rw-r--r--themes/hugo-book/layouts/_partials/docs/inject/content-before.html0
-rw-r--r--themes/hugo-book/layouts/_partials/docs/inject/footer.html0
-rw-r--r--themes/hugo-book/layouts/_partials/docs/inject/head.html0
-rw-r--r--themes/hugo-book/layouts/_partials/docs/inject/menu-after.html0
-rw-r--r--themes/hugo-book/layouts/_partials/docs/inject/menu-before.html0
-rw-r--r--themes/hugo-book/layouts/_partials/docs/inject/toc-after.html0
-rw-r--r--themes/hugo-book/layouts/_partials/docs/inject/toc-before.html0
-rw-r--r--themes/hugo-book/layouts/_partials/docs/languages.html33
-rw-r--r--themes/hugo-book/layouts/_partials/docs/links/commit.html5
-rw-r--r--themes/hugo-book/layouts/_partials/docs/links/edit.html5
-rw-r--r--themes/hugo-book/layouts/_partials/docs/links/portable-image.html26
-rw-r--r--themes/hugo-book/layouts/_partials/docs/links/portable-link.html29
-rw-r--r--themes/hugo-book/layouts/_partials/docs/menu-filetree.html49
-rw-r--r--themes/hugo-book/layouts/_partials/docs/menu-hugo.html29
-rw-r--r--themes/hugo-book/layouts/_partials/docs/menu.html21
-rw-r--r--themes/hugo-book/layouts/_partials/docs/pagination.html28
-rw-r--r--themes/hugo-book/layouts/_partials/docs/post-meta.html16
-rw-r--r--themes/hugo-book/layouts/_partials/docs/post-prev-next.html18
-rw-r--r--themes/hugo-book/layouts/_partials/docs/prev-next-cache.html14
-rw-r--r--themes/hugo-book/layouts/_partials/docs/prev-next.html31
-rw-r--r--themes/hugo-book/layouts/_partials/docs/search.html8
-rw-r--r--themes/hugo-book/layouts/_partials/docs/taxonomy.html19
-rw-r--r--themes/hugo-book/layouts/_partials/docs/text/template.html9
-rw-r--r--themes/hugo-book/layouts/_partials/docs/title.html17
-rw-r--r--themes/hugo-book/layouts/_partials/docs/toc-show.html4
-rw-r--r--themes/hugo-book/layouts/_partials/docs/toc.html3
36 files changed, 480 insertions, 0 deletions
diff --git a/themes/hugo-book/layouts/_partials/docs/brand.html b/themes/hugo-book/layouts/_partials/docs/brand.html
new file mode 100644
index 0000000..7824ef1
--- /dev/null
+++ b/themes/hugo-book/layouts/_partials/docs/brand.html
@@ -0,0 +1,8 @@
+<h2 class="book-brand">
+ <a class="flex align-center" href="{{ cond (not .Site.Home.File) .Sites.Default.Home.RelPermalink .Site.Home.RelPermalink }}">
+ {{- with .Site.Params.BookLogo -}}
+ <img src="{{ . | relURL }}" alt="Logo" />
+ {{- end -}}
+ <span>{{ .Site.Title }}</span>
+ </a>
+</h2>
diff --git a/themes/hugo-book/layouts/_partials/docs/comments.html b/themes/hugo-book/layouts/_partials/docs/comments.html
new file mode 100644
index 0000000..59c5f22
--- /dev/null
+++ b/themes/hugo-book/layouts/_partials/docs/comments.html
@@ -0,0 +1,2 @@
+<!-- This partial can be replaced to support other commenting engines -->
+{{ template "_internal/disqus.html" . }}
diff --git a/themes/hugo-book/layouts/_partials/docs/date.html b/themes/hugo-book/layouts/_partials/docs/date.html
new file mode 100644
index 0000000..8c75361
--- /dev/null
+++ b/themes/hugo-book/layouts/_partials/docs/date.html
@@ -0,0 +1,6 @@
+<!--
+ Returns formatted date.
+ Usage: partial "docs/date" (dict "Date" .Date "Format" .Site.Params.BookDateFormat)
+-->
+{{- $format := default "January 2, 2006" .Format -}}
+{{- return (time.Format $format .Date) -}}
diff --git a/themes/hugo-book/layouts/_partials/docs/footer.html b/themes/hugo-book/layouts/_partials/docs/footer.html
new file mode 100644
index 0000000..01d8322
--- /dev/null
+++ b/themes/hugo-book/layouts/_partials/docs/footer.html
@@ -0,0 +1,29 @@
+<div class="flex flex-wrap justify-between">
+
+{{ if and .GitInfo .Site.Params.BookLastChangeLink }}
+<div>
+ {{- $date := partial "docs/date" (dict "Date" .Lastmod "Format" .Site.Params.BookDateFormat) -}}
+ <a class="flex align-center" href="{{ partial "docs/links/commit" . }}" title='{{ i18n "Last modified by" }} {{ .GitInfo.AuthorName }} | {{ $date }}' target="_blank" rel="noopener">
+ <img src="{{ "svg/calendar.svg" | relURL }}" class="book-icon" alt="" />
+ <span>{{ $date }}</span>
+ </a>
+</div>
+{{ end }}
+
+{{ if and .File .Site.Params.BookEditLink }}
+<div>
+ <a class="flex align-center" href="{{ partial "docs/links/edit" . }}" target="_blank" rel="noopener edit">
+ <img src="{{ "svg/edit.svg" | relURL }}" class="book-icon" alt="" />
+ <span>{{ i18n "Edit this page" }}</span>
+ </a>
+</div>
+{{ end }}
+
+</div>
+
+{{ partial "docs/prev-next" . }}
+
+{{ $script := resources.Get "clipboard.js" | resources.Minify }}
+{{ with $script.Content }}
+ <script>{{ . | safeJS }}</script>
+{{ end }}
diff --git a/themes/hugo-book/layouts/_partials/docs/header.html b/themes/hugo-book/layouts/_partials/docs/header.html
new file mode 100644
index 0000000..ad5582e
--- /dev/null
+++ b/themes/hugo-book/layouts/_partials/docs/header.html
@@ -0,0 +1,13 @@
+<div class="flex align-center justify-between">
+ <label for="menu-control">
+ <img src="{{ "svg/menu.svg" | relURL }}" class="book-icon" alt="Menu" />
+ </label>
+
+ <h3>{{ partial "docs/title" . }}</h3>
+
+ <label for="toc-control">
+ {{ if partial "docs/toc-show" . }}
+ <img src="{{ "svg/toc.svg" | relURL }}" class="book-icon" alt="Table of Contents" />
+ {{ end }}
+ </label>
+</div>
diff --git a/themes/hugo-book/layouts/_partials/docs/html-head-favicon.html b/themes/hugo-book/layouts/_partials/docs/html-head-favicon.html
new file mode 100644
index 0000000..8278050
--- /dev/null
+++ b/themes/hugo-book/layouts/_partials/docs/html-head-favicon.html
@@ -0,0 +1 @@
+<link rel="icon" href="{{ .Site.Params.BookFavicon | default "favicon.png" | relURL }}" > \ No newline at end of file
diff --git a/themes/hugo-book/layouts/_partials/docs/html-head-title.html b/themes/hugo-book/layouts/_partials/docs/html-head-title.html
new file mode 100644
index 0000000..49a109d
--- /dev/null
+++ b/themes/hugo-book/layouts/_partials/docs/html-head-title.html
@@ -0,0 +1 @@
+{{ partial "docs/title" . }} | {{ .Site.Title -}}
diff --git a/themes/hugo-book/layouts/_partials/docs/html-head.html b/themes/hugo-book/layouts/_partials/docs/html-head.html
new file mode 100644
index 0000000..6a6d0ec
--- /dev/null
+++ b/themes/hugo-book/layouts/_partials/docs/html-head.html
@@ -0,0 +1,56 @@
+<meta charset="UTF-8">
+<meta name="viewport" content="width=device-width, initial-scale=1.0">
+<meta name="description" content="{{ default .Summary .Description }}">
+<meta name="theme-color" media="(prefers-color-scheme: light)" content="#ffffff">
+<meta name="theme-color" media="(prefers-color-scheme: dark)" content="#343a40">
+<meta name="color-scheme" content="light dark">
+
+{{- with .Page.Params.BookHref -}}
+ <meta http-equiv="Refresh" content="0; url='{{ . }}'" />
+{{- end -}}
+
+{{- template "_internal/opengraph.html" . -}}
+
+<title>{{ partial "docs/html-head-title" . }}</title>
+{{ partial "docs/html-head-favicon" . }}
+
+{{- $manifest := resources.Get "manifest.json" | resources.ExecuteAsTemplate "manifest.json" . }}
+<link rel="manifest" href="{{ $manifest.RelPermalink }}">
+<link rel="canonical" href="{{ .Permalink }}">
+
+{{- range .Translations }}
+ <link rel="alternate" hreflang="{{ default .Site.LanguageCode .Language.Lang }}" href="{{ .Permalink }}" title="{{ partial "docs/title" . }}">
+{{- end -}}
+
+<!-- Theme stylesheet, you can customize scss by creating `assets/custom.scss` in your website -->
+{{- $styles := resources.Get "book.scss" | resources.ExecuteAsTemplate "book.scss" . | css.Sass | resources.Minify | resources.Fingerprint }}
+<link rel="stylesheet" href="{{ $styles.RelPermalink }}" {{ template "integrity" $styles }}>
+{{- if default true .Site.Params.BookSearch -}}
+ {{- $searchJSFile := printf "%s.search.js" .Language.Lang }}
+ {{- $searchJS := resources.Get "search.js" | resources.ExecuteAsTemplate $searchJSFile . | resources.Minify | resources.Fingerprint }}
+ <script defer src="{{ "fuse.min.js" | relURL }}"></script>
+ <script defer src="{{ $searchJS.RelPermalink }}" {{ template "integrity" $searchJS }}></script>
+{{ end -}}
+
+{{- if .Site.Params.BookServiceWorker -}}
+ {{- $swJS := resources.Get "sw-register.js" | resources.ExecuteAsTemplate "sw.js" . | resources.Minify | resources.Fingerprint }}
+ <script defer src="{{ $swJS.RelPermalink }}" {{ template "integrity" $swJS }}></script>
+{{ end -}}
+
+{{- template "_internal/google_analytics.html" . -}}
+
+<!-- RSS -->
+{{- with .OutputFormats.Get "rss" -}}
+ {{ printf `<link rel="%s" type="%s" href="%s" title="%s" />` .Rel .MediaType.Type .Permalink $.Site.Title | safeHTML }}
+{{ end -}}
+
+{{ "<!--" | safeHTML }}
+Made with Book Theme
+https://github.com/alex-shpak/hugo-book
+{{ "-->" | safeHTML }}
+
+{{- define "integrity" -}}
+ {{- if (urls.Parse .Permalink).Host -}}
+ integrity="{{ .Data.Integrity }}" crossorigin="anonymous"
+ {{- end -}}
+{{- end -}}
diff --git a/themes/hugo-book/layouts/_partials/docs/inject/body.html b/themes/hugo-book/layouts/_partials/docs/inject/body.html
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/themes/hugo-book/layouts/_partials/docs/inject/body.html
diff --git a/themes/hugo-book/layouts/_partials/docs/inject/content-after.html b/themes/hugo-book/layouts/_partials/docs/inject/content-after.html
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/themes/hugo-book/layouts/_partials/docs/inject/content-after.html
diff --git a/themes/hugo-book/layouts/_partials/docs/inject/content-before.html b/themes/hugo-book/layouts/_partials/docs/inject/content-before.html
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/themes/hugo-book/layouts/_partials/docs/inject/content-before.html
diff --git a/themes/hugo-book/layouts/_partials/docs/inject/footer.html b/themes/hugo-book/layouts/_partials/docs/inject/footer.html
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/themes/hugo-book/layouts/_partials/docs/inject/footer.html
diff --git a/themes/hugo-book/layouts/_partials/docs/inject/head.html b/themes/hugo-book/layouts/_partials/docs/inject/head.html
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/themes/hugo-book/layouts/_partials/docs/inject/head.html
diff --git a/themes/hugo-book/layouts/_partials/docs/inject/menu-after.html b/themes/hugo-book/layouts/_partials/docs/inject/menu-after.html
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/themes/hugo-book/layouts/_partials/docs/inject/menu-after.html
diff --git a/themes/hugo-book/layouts/_partials/docs/inject/menu-before.html b/themes/hugo-book/layouts/_partials/docs/inject/menu-before.html
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/themes/hugo-book/layouts/_partials/docs/inject/menu-before.html
diff --git a/themes/hugo-book/layouts/_partials/docs/inject/toc-after.html b/themes/hugo-book/layouts/_partials/docs/inject/toc-after.html
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/themes/hugo-book/layouts/_partials/docs/inject/toc-after.html
diff --git a/themes/hugo-book/layouts/_partials/docs/inject/toc-before.html b/themes/hugo-book/layouts/_partials/docs/inject/toc-before.html
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/themes/hugo-book/layouts/_partials/docs/inject/toc-before.html
diff --git a/themes/hugo-book/layouts/_partials/docs/languages.html b/themes/hugo-book/layouts/_partials/docs/languages.html
new file mode 100644
index 0000000..70ddc0a
--- /dev/null
+++ b/themes/hugo-book/layouts/_partials/docs/languages.html
@@ -0,0 +1,33 @@
+<!-- Merge home and current page translations -->
+{{ $bookTranslatedOnly := default false .Site.Params.BookTranslatedOnly }}
+{{ $translations := dict }}
+{{ if (eq $bookTranslatedOnly false ) }}
+ {{ range .Site.Home.Translations }}
+ {{ $translations = merge $translations (dict .Language.Lang .) }}
+ {{ end }}
+{{ end }}
+{{ range .Translations }}
+ {{ $translations = merge $translations (dict .Language.Lang .) }}
+{{ end }}
+
+<ul class="book-languages">
+ <li>
+ <input type="checkbox" id="languages" class="toggle" />
+ <label for="languages" class="flex">
+ <a role="button" class="flex flex-auto">
+ <img src="{{ "svg/translate.svg" | relURL }}" class="book-icon" alt="Languages" />
+ <span>{{ $.Site.Language.LanguageName }}</span>
+ </a>
+ </label>
+
+ <ul>
+ {{ range .Site.Languages }}{{ with index $translations .Lang }}
+ <li>
+ <a href="{{ cond hugo.IsMultihost .Permalink .RelPermalink }}">
+ <span>{{ .Language.LanguageName }}</span>
+ </a>
+ </li>
+ {{ end }}{{ end }}
+ </ul>
+ </li>
+</ul>
diff --git a/themes/hugo-book/layouts/_partials/docs/links/commit.html b/themes/hugo-book/layouts/_partials/docs/links/commit.html
new file mode 100644
index 0000000..a20f07c
--- /dev/null
+++ b/themes/hugo-book/layouts/_partials/docs/links/commit.html
@@ -0,0 +1,5 @@
+{{- return (partial "docs/text/template" (dict "Template" .Site.Params.BookLastChangeLink "Context" (dict
+ "Site" .Site
+ "Page" .Page
+ "GitInfo" .GitInfo
+)) | urls.JoinPath) -}} \ No newline at end of file
diff --git a/themes/hugo-book/layouts/_partials/docs/links/edit.html b/themes/hugo-book/layouts/_partials/docs/links/edit.html
new file mode 100644
index 0000000..3243412
--- /dev/null
+++ b/themes/hugo-book/layouts/_partials/docs/links/edit.html
@@ -0,0 +1,5 @@
+{{- return (partial "docs/text/template" (dict "Template" .Site.Params.BookEditLink "Context" (dict
+ "Site" .Site
+ "Page" .Page
+ "Path" (strings.TrimPrefix hugo.WorkingDir .Page.File.Filename)
+)) | urls.JoinPath) -}} \ No newline at end of file
diff --git a/themes/hugo-book/layouts/_partials/docs/links/portable-image.html b/themes/hugo-book/layouts/_partials/docs/links/portable-image.html
new file mode 100644
index 0000000..4b9bc44
--- /dev/null
+++ b/themes/hugo-book/layouts/_partials/docs/links/portable-image.html
@@ -0,0 +1,26 @@
+{{- $destination := .Destination -}}
+{{- $url := urls.Parse .Destination -}}
+
+{{- $isRemote := gt (len $url.Host) 0 -}}
+{{- $isFragment := strings.HasPrefix .Destination "#" -}}
+
+{{- if and (not $isRemote) (not $isFragment) -}}
+ {{- $path := strings.TrimPrefix "./" $url.Path -}}
+ {{- $path = strings.TrimPrefix "/assets/" $path -}}
+
+ {{- with (.Page.Resources.Get $path) -}}
+ {{- $destination = .RelPermalink -}}
+ {{- else with (resources.Get $path) -}}
+ {{- $destination = .RelPermalink -}}
+ {{- else -}}
+ {{- warnf "Image reference '%s' not found in '%s'" .Destination .Page.Permalink -}}
+ {{- end -}}
+
+ {{- with $url.RawQuery -}}
+ {{- $destination = print $destination "?" . -}}
+ {{- end -}}
+ {{- with $url.Fragment -}}
+ {{- $destination = print $destination "#" . -}}
+ {{- end -}}
+{{- end -}}
+{{- return $destination -}}
diff --git a/themes/hugo-book/layouts/_partials/docs/links/portable-link.html b/themes/hugo-book/layouts/_partials/docs/links/portable-link.html
new file mode 100644
index 0000000..4c5c0c0
--- /dev/null
+++ b/themes/hugo-book/layouts/_partials/docs/links/portable-link.html
@@ -0,0 +1,29 @@
+{{- $destination := .Destination -}}
+{{- $url := urls.Parse .Destination -}}
+
+{{- $isRemote := gt (len $url.Host) 0 -}}
+{{- $isFragment := strings.HasPrefix .Destination "#" -}}
+
+{{- if and (not $isRemote) (not $isFragment) -}}
+ {{- $path := strings.TrimPrefix "./" $url.Path -}}
+ {{- $path = strings.TrimSuffix ".md" $path -}}
+ {{- $path = strings.TrimSuffix "/_index" $path -}}
+
+ {{- with (.Page.GetPage $path) -}}
+ {{- $destination = .RelPermalink -}}
+ {{- else with (.Page.Resources.Get $path) -}}
+ {{- $destination = .RelPermalink -}}
+ {{- else with (resources.Get $path) -}}
+ {{- $destination = .RelPermalink -}}
+ {{- else -}}
+ {{- warnf "Reference '%s' not found in '%s'" .Destination .Page.Permalink -}}
+ {{- end -}}
+
+ {{- with $url.RawQuery -}}
+ {{- $destination = print $destination "?" . -}}
+ {{- end -}}
+ {{- with $url.Fragment -}}
+ {{- $destination = print $destination "#" . -}}
+ {{- end -}}
+{{- end -}}
+{{- return $destination -}} \ No newline at end of file
diff --git a/themes/hugo-book/layouts/_partials/docs/menu-filetree.html b/themes/hugo-book/layouts/_partials/docs/menu-filetree.html
new file mode 100644
index 0000000..5105aa8
--- /dev/null
+++ b/themes/hugo-book/layouts/_partials/docs/menu-filetree.html
@@ -0,0 +1,49 @@
+{{ $bookSection := default "docs" .Site.Params.BookSection }}
+{{ if eq $bookSection "*" }}
+ {{ $bookSection = "/" }}{{/* Backward compatibility */}}
+{{ end }}
+
+{{ with .Site.GetPage $bookSection }}
+ {{ template "book-section-children" (dict "Section" . "CurrentPage" $) }}
+{{ end }}
+
+{{ define "book-section-children" }}{{/* (dict "Section" .Section "CurrentPage" .CurrentPage) */}}
+ <ul>
+ {{ range (where .Section.Pages "Params.bookHidden" "ne" true) }}
+ {{ if .IsSection }}
+ <li {{- if .Params.BookFlatSection }} class="book-section-flat" {{ end -}}>
+ {{ template "book-page-link" (dict "Page" . "CurrentPage" $.CurrentPage) }}
+ {{ template "book-section-children" (dict "Section" . "CurrentPage" $.CurrentPage) }}
+ </li>
+ {{ else if and .IsPage .Content }}
+ <li>
+ {{ template "book-page-link" (dict "Page" . "CurrentPage" $.CurrentPage) }}
+ </li>
+ {{ end }}
+ {{ end }}
+ </ul>
+{{ end }}
+
+{{ define "book-page-link" }}{{/* (dict "Page" .Page "CurrentPage" .CurrentPage) */}}
+ {{ $current := eq .CurrentPage .Page }}
+ {{ $ancestor := .Page.IsAncestor .CurrentPage }}
+
+ {{ if .Page.Params.BookCollapseSection }}
+ <input type="checkbox" id="section-{{ md5 .Page }}" class="toggle" {{ if or $current $ancestor }}checked{{ end }} />
+ <label for="section-{{ md5 .Page }}" class="flex">
+ <a {{ if .Page.Content }}href="{{ .Page.RelPermalink }}"{{ else }}role="button"{{ end }} class="flex-auto {{ if $current }}active{{ end }}">
+ {{- partial "docs/title" .Page -}}
+ </a>
+ </label>
+ {{ else if .Page.Params.BookHref }}
+ <a href="{{ .Page.Params.BookHref }}" class="{{ if $current }}active{{ end }}" target="_blank" rel="noopener">
+ {{- partial "docs/title" .Page -}}
+ </a>
+ {{ else if .Page.Content }}
+ <a href="{{ .Page.RelPermalink }}" class="{{ if $current }}active{{ end }}">
+ {{- partial "docs/title" .Page -}}
+ </a>
+ {{ else }}
+ <span>{{- partial "docs/title" .Page -}}</span>
+ {{ end }}
+{{ end }}
diff --git a/themes/hugo-book/layouts/_partials/docs/menu-hugo.html b/themes/hugo-book/layouts/_partials/docs/menu-hugo.html
new file mode 100644
index 0000000..871eea7
--- /dev/null
+++ b/themes/hugo-book/layouts/_partials/docs/menu-hugo.html
@@ -0,0 +1,29 @@
+<!--
+ This is template for hugo menus, accepts MenuEntity as context
+ https://gohugo.io/variables/menus/
+-->
+{{ if . }}
+ {{ template "book-menu-hugo" . }}
+{{ end }}
+
+{{ define "book-menu-hugo" }}
+<ul>
+ {{ range . }}
+ <li>
+ {{ $isRemote := not (or (.Page) (strings.HasPrefix .URL "/")) }}
+ <a href="{{ .URL }}" {{ with .Params.class }}class="{{ . }}"{{ end }} {{ if $isRemote }}target="_blank" rel="noopener"{{ end }}>
+ {{- .Pre -}}
+ {{ with .Page }}
+ {{ partial "docs/title" .Page }}
+ {{ else }}
+ {{ .Name }}
+ {{ end }}
+ {{- .Post -}}
+ </a>
+ {{- with .Children }}
+ {{ template "book-menu-hugo" . }}
+ {{- end }}
+ </li>
+ {{ end }}
+</ul>
+{{ end }}
diff --git a/themes/hugo-book/layouts/_partials/docs/menu.html b/themes/hugo-book/layouts/_partials/docs/menu.html
new file mode 100644
index 0000000..dbb2e49
--- /dev/null
+++ b/themes/hugo-book/layouts/_partials/docs/menu.html
@@ -0,0 +1,21 @@
+<nav>
+{{ partial "docs/brand" . }}
+{{ partial "docs/search" . }}
+{{ if hugo.IsMultilingual }}
+ {{ partial "docs/languages" . }}
+{{ end }}
+
+{{ partial "docs/inject/menu-before" . }}
+{{ partial "docs/menu-hugo" .Site.Menus.before }}
+
+{{ partial "docs/menu-filetree" . }}
+
+{{ partial "docs/menu-hugo" .Site.Menus.after }}
+{{ partial "docs/inject/menu-after" . }}
+</nav>
+
+<!-- Restore menu position as soon as possible to avoid flickering -->
+{{ $script := resources.Get "menu-reset.js" | resources.Minify }}
+{{ with $script.Content }}
+ <script>{{ . | safeJS }}</script>
+{{ end }}
diff --git a/themes/hugo-book/layouts/_partials/docs/pagination.html b/themes/hugo-book/layouts/_partials/docs/pagination.html
new file mode 100644
index 0000000..9e0d154
--- /dev/null
+++ b/themes/hugo-book/layouts/_partials/docs/pagination.html
@@ -0,0 +1,28 @@
+{{- if .Paginator -}}
+<div class="flex flex-wrap justify-between">
+ <span>
+ {{- with .Paginator.Prev }}
+ <a href="{{ .URL }}" class="flex align-center">
+ <img src="{{ "svg/backward.svg" | relURL }}" class="book-icon" alt="Previous" />
+ </a>
+ {{ end }}
+ </span>
+ {{ if gt (len .Paginator.Pagers) 1 }}
+ <span class="flex gap">
+ {{- $currentPageNumber := .Paginator.PageNumber -}}
+ {{- range $pageIndex := (slice -2 -1 0 1 2) -}}
+ {{- with index $.Paginator.Pagers (add $currentPageNumber $pageIndex -1) -}}
+ <a {{if ne $currentPageNumber .PageNumber }}href="{{ .URL }}"{{end}}>{{ .PageNumber }}</a>
+ {{- end -}}
+ {{- end -}}
+ </span>
+ {{ end }}
+ <span>
+ {{- with .Paginator.Next }}
+ <a href="{{ .URL }}" class="flex align-center">
+ <img src="{{ "svg/forward.svg" | relURL }}" class="book-icon" alt="Next" />
+ </a>
+ {{ end }}
+ </span>
+</div>
+{{- end -}}
diff --git a/themes/hugo-book/layouts/_partials/docs/post-meta.html b/themes/hugo-book/layouts/_partials/docs/post-meta.html
new file mode 100644
index 0000000..457e2c0
--- /dev/null
+++ b/themes/hugo-book/layouts/_partials/docs/post-meta.html
@@ -0,0 +1,16 @@
+{{ with .Date }}
+ <div class="flex align-center text-small book-post-date">
+ <img src="{{ "svg/calendar.svg" | relURL }}" class="book-icon " alt="" />
+ <span>{{ partial "docs/date" (dict "Date" . "Format" $.Site.Params.BookDateFormat) }}</span>
+ </div>
+{{ end }}
+
+{{ range $taxonomy, $_ := .Site.Taxonomies }}
+ {{ with $terms := $.GetTerms $taxonomy }}
+ <div class="text-small">
+ {{ range $n, $term := $terms }}{{ if $n }}, {{ end }}
+ <a href="{{ $term.RelPermalink }}">{{ $term.Title }}</a>
+ {{- end }}
+ </div>
+ {{ end }}
+{{ end }}
diff --git a/themes/hugo-book/layouts/_partials/docs/post-prev-next.html b/themes/hugo-book/layouts/_partials/docs/post-prev-next.html
new file mode 100644
index 0000000..d7192c0
--- /dev/null
+++ b/themes/hugo-book/layouts/_partials/docs/post-prev-next.html
@@ -0,0 +1,18 @@
+<div class="flex flex-wrap justify-between">
+ <span>
+ {{ with .NextInSection }}
+ <a href="{{ .RelPermalink }}" class="flex align-center">
+ <img src="{{ "svg/backward.svg" | relURL }}" class="book-icon" alt="Previous" title="{{ partial "docs/title" . }}" />
+ <span>{{ partial "docs/title" . }}</span>
+ </a>
+ {{ end }}
+ </span>
+ <span>
+ {{ with .PrevInSection }}
+ <a href="{{ .RelPermalink }}" class="flex align-center">
+ <span>{{ partial "docs/title" . }}</span>
+ <img src="{{ "svg/forward.svg" | relURL }}" class="book-icon" alt="Next" title="{{ partial "docs/title" . }}" />
+ </a>
+ {{ end }}
+ </span>
+</div> \ No newline at end of file
diff --git a/themes/hugo-book/layouts/_partials/docs/prev-next-cache.html b/themes/hugo-book/layouts/_partials/docs/prev-next-cache.html
new file mode 100644
index 0000000..1561c06
--- /dev/null
+++ b/themes/hugo-book/layouts/_partials/docs/prev-next-cache.html
@@ -0,0 +1,14 @@
+{{ $scratch := newScratch }}
+{{ template "recurse" (dict "Scratch" $scratch "Sections" .) }}
+{{ define "recurse" }}
+ {{ range .Sections }}
+ {{ if and .Content (not .Params.BookHidden) }}
+ {{ $.Scratch.Add "BookPages" (slice .) }}
+ {{ end }}
+ {{ if .IsSection }}
+ {{ template "recurse" (dict "Scratch" $.Scratch "Sections" .Pages) }}
+ {{ end }}
+ {{ end }}
+{{ end }}
+
+{{ return $scratch.Get "BookPages" }}
diff --git a/themes/hugo-book/layouts/_partials/docs/prev-next.html b/themes/hugo-book/layouts/_partials/docs/prev-next.html
new file mode 100644
index 0000000..d93e5ed
--- /dev/null
+++ b/themes/hugo-book/layouts/_partials/docs/prev-next.html
@@ -0,0 +1,31 @@
+{{ $bookSection := default "docs" .Site.Params.BookSection }}
+{{ if eq $bookSection "*" }}
+ {{ $bookSection = "/" }}{{/* Backward compatibility */}}
+{{ end }}
+
+{{ with .Site.GetPage $bookSection }}
+ {{ $pages := partialCached "docs/prev-next-cache" .Pages }}
+ {{ $prev := $pages.Next $ }}
+ {{ $next := $pages.Prev $ }}
+
+ {{- if or $prev $next }}
+ <div class="flex flex-wrap justify-between">
+ <span>
+ {{ with $prev }}
+ <a href="{{ .RelPermalink }}" class="flex align-center">
+ <img src="{{ "svg/backward.svg" | relURL }}" class="book-icon" alt="Previous" title="{{ partial "docs/title" . }}" />
+ <span>{{ partial "docs/title" . }}</span>
+ </a>
+ {{ end }}
+ </span>
+ <span>
+ {{ with $next }}
+ <a href="{{ .RelPermalink }}" class="flex align-center">
+ <span>{{ partial "docs/title" . }}</span>
+ <img src="{{ "svg/forward.svg" | relURL }}" class="book-icon" alt="Next" title="{{ partial "docs/title" . }}" />
+ </a>
+ {{ end }}
+ </span>
+ </div>
+ {{ end -}}
+{{ end }}
diff --git a/themes/hugo-book/layouts/_partials/docs/search.html b/themes/hugo-book/layouts/_partials/docs/search.html
new file mode 100644
index 0000000..937f595
--- /dev/null
+++ b/themes/hugo-book/layouts/_partials/docs/search.html
@@ -0,0 +1,8 @@
+{{ if default true .Site.Params.BookSearch }}
+<div class="book-search hidden">
+ <input type="text" id="book-search-input" placeholder="{{ i18n "Search" }}" aria-label="{{ i18n "Search" }}" maxlength="64" data-hotkeys="s/" />
+ <div class="book-search-spinner hidden"></div>
+ <ul id="book-search-results"></ul>
+</div>
+<script>document.querySelector(".book-search").classList.remove("hidden")</script>
+{{ end }}
diff --git a/themes/hugo-book/layouts/_partials/docs/taxonomy.html b/themes/hugo-book/layouts/_partials/docs/taxonomy.html
new file mode 100644
index 0000000..90366ae
--- /dev/null
+++ b/themes/hugo-book/layouts/_partials/docs/taxonomy.html
@@ -0,0 +1,19 @@
+<nav>
+ <ul>
+ {{ range $term, $_ := .Site.Taxonomies }}
+ {{ with $.Site.GetPage (printf "/%s" $term | urlize) }}
+ <li class="book-section-flat">
+ <span>{{ .Title | title }}</span>
+ <ul>
+ {{ range .Pages }}
+ <li class="flex justify-between">
+ <a href="{{ .RelPermalink }}">{{ .Title }}</a>
+ <span>{{ len .Pages }}</span>
+ </li>
+ {{ end }}
+ </ul>
+ </li>
+ {{ end }}
+ {{ end }}
+ </ul>
+</nav>
diff --git a/themes/hugo-book/layouts/_partials/docs/text/template.html b/themes/hugo-book/layouts/_partials/docs/text/template.html
new file mode 100644
index 0000000..53e535d
--- /dev/null
+++ b/themes/hugo-book/layouts/_partials/docs/text/template.html
@@ -0,0 +1,9 @@
+<!--
+ Returns rendered string from template and context.
+ Usage: partial "docs/string-template" (dict "Template" "param={{ . }}" "Context" "Input")
+-->
+
+{{- $checksum := . | encoding.Jsonify | crypto.SHA1 | printf "book-%s" -}}
+{{- $template := resources.FromString $checksum .Template -}}
+{{- $template = $template | resources.ExecuteAsTemplate $checksum .Context -}}
+{{- return $template.Content -}} \ No newline at end of file
diff --git a/themes/hugo-book/layouts/_partials/docs/title.html b/themes/hugo-book/layouts/_partials/docs/title.html
new file mode 100644
index 0000000..83df5b6
--- /dev/null
+++ b/themes/hugo-book/layouts/_partials/docs/title.html
@@ -0,0 +1,17 @@
+<!--
+ Partial to generate page name from Title or File name.
+ Accepts Page as context
+-->
+{{ $title := "" }}
+
+{{ if .LinkTitle }}
+ {{ $title = .LinkTitle }}
+{{ else if .Title }}
+ {{ $title = .Title }}
+{{ else if and .IsSection .File }}
+ {{ $title = path.Base .File.Dir | humanize | title }}
+{{ else if and .IsPage .File }}
+ {{ $title = .File.BaseFileName | humanize | title }}
+{{ end }}
+
+{{ return $title }}
diff --git a/themes/hugo-book/layouts/_partials/docs/toc-show.html b/themes/hugo-book/layouts/_partials/docs/toc-show.html
new file mode 100644
index 0000000..5115c84
--- /dev/null
+++ b/themes/hugo-book/layouts/_partials/docs/toc-show.html
@@ -0,0 +1,4 @@
+{{ return default
+ (not (eq .TableOfContents "<nav id=\"TableOfContents\"></nav>"))
+ (default .Site.Params.BookToC .Params.BookToC)
+}} \ No newline at end of file
diff --git a/themes/hugo-book/layouts/_partials/docs/toc.html b/themes/hugo-book/layouts/_partials/docs/toc.html
new file mode 100644
index 0000000..64697a4
--- /dev/null
+++ b/themes/hugo-book/layouts/_partials/docs/toc.html
@@ -0,0 +1,3 @@
+{{ partial "docs/inject/toc-before" . }}
+{{ .TableOfContents }}
+{{ partial "docs/inject/toc-after" . }}
Directive (EU) 2019/790, Article 4(3); all rights regarding Text and Data Mining (TDM) are reserved.