From 9b5f3fad7068298265dbbc8a65077f7917a090a5 Mon Sep 17 00:00:00 2001 From: aethrvmn Date: Sun, 21 Sep 2025 00:27:35 +0200 Subject: updated hugo-book theme --- themes/hugo-book/layouts/_partials/docs/brand.html | 8 ++++ .../hugo-book/layouts/_partials/docs/comments.html | 2 + themes/hugo-book/layouts/_partials/docs/date.html | 6 +++ .../hugo-book/layouts/_partials/docs/footer.html | 29 +++++++++++ .../hugo-book/layouts/_partials/docs/header.html | 13 +++++ .../layouts/_partials/docs/html-head-favicon.html | 1 + .../layouts/_partials/docs/html-head-title.html | 1 + .../layouts/_partials/docs/html-head.html | 56 ++++++++++++++++++++++ .../layouts/_partials/docs/inject/body.html | 0 .../_partials/docs/inject/content-after.html | 0 .../_partials/docs/inject/content-before.html | 0 .../layouts/_partials/docs/inject/footer.html | 0 .../layouts/_partials/docs/inject/head.html | 0 .../layouts/_partials/docs/inject/menu-after.html | 0 .../layouts/_partials/docs/inject/menu-before.html | 0 .../layouts/_partials/docs/inject/toc-after.html | 0 .../layouts/_partials/docs/inject/toc-before.html | 0 .../layouts/_partials/docs/languages.html | 33 +++++++++++++ .../layouts/_partials/docs/links/commit.html | 5 ++ .../layouts/_partials/docs/links/edit.html | 5 ++ .../_partials/docs/links/portable-image.html | 26 ++++++++++ .../_partials/docs/links/portable-link.html | 29 +++++++++++ .../layouts/_partials/docs/menu-filetree.html | 49 +++++++++++++++++++ .../layouts/_partials/docs/menu-hugo.html | 29 +++++++++++ themes/hugo-book/layouts/_partials/docs/menu.html | 21 ++++++++ .../layouts/_partials/docs/pagination.html | 28 +++++++++++ .../layouts/_partials/docs/post-meta.html | 16 +++++++ .../layouts/_partials/docs/post-prev-next.html | 18 +++++++ .../layouts/_partials/docs/prev-next-cache.html | 14 ++++++ .../layouts/_partials/docs/prev-next.html | 31 ++++++++++++ .../hugo-book/layouts/_partials/docs/search.html | 8 ++++ .../hugo-book/layouts/_partials/docs/taxonomy.html | 19 ++++++++ .../layouts/_partials/docs/text/template.html | 9 ++++ themes/hugo-book/layouts/_partials/docs/title.html | 17 +++++++ .../hugo-book/layouts/_partials/docs/toc-show.html | 4 ++ themes/hugo-book/layouts/_partials/docs/toc.html | 3 ++ 36 files changed, 480 insertions(+) create mode 100644 themes/hugo-book/layouts/_partials/docs/brand.html create mode 100644 themes/hugo-book/layouts/_partials/docs/comments.html create mode 100644 themes/hugo-book/layouts/_partials/docs/date.html create mode 100644 themes/hugo-book/layouts/_partials/docs/footer.html create mode 100644 themes/hugo-book/layouts/_partials/docs/header.html create mode 100644 themes/hugo-book/layouts/_partials/docs/html-head-favicon.html create mode 100644 themes/hugo-book/layouts/_partials/docs/html-head-title.html create mode 100644 themes/hugo-book/layouts/_partials/docs/html-head.html create mode 100644 themes/hugo-book/layouts/_partials/docs/inject/body.html create mode 100644 themes/hugo-book/layouts/_partials/docs/inject/content-after.html create mode 100644 themes/hugo-book/layouts/_partials/docs/inject/content-before.html create mode 100644 themes/hugo-book/layouts/_partials/docs/inject/footer.html create mode 100644 themes/hugo-book/layouts/_partials/docs/inject/head.html create mode 100644 themes/hugo-book/layouts/_partials/docs/inject/menu-after.html create mode 100644 themes/hugo-book/layouts/_partials/docs/inject/menu-before.html create mode 100644 themes/hugo-book/layouts/_partials/docs/inject/toc-after.html create mode 100644 themes/hugo-book/layouts/_partials/docs/inject/toc-before.html create mode 100644 themes/hugo-book/layouts/_partials/docs/languages.html create mode 100644 themes/hugo-book/layouts/_partials/docs/links/commit.html create mode 100644 themes/hugo-book/layouts/_partials/docs/links/edit.html create mode 100644 themes/hugo-book/layouts/_partials/docs/links/portable-image.html create mode 100644 themes/hugo-book/layouts/_partials/docs/links/portable-link.html create mode 100644 themes/hugo-book/layouts/_partials/docs/menu-filetree.html create mode 100644 themes/hugo-book/layouts/_partials/docs/menu-hugo.html create mode 100644 themes/hugo-book/layouts/_partials/docs/menu.html create mode 100644 themes/hugo-book/layouts/_partials/docs/pagination.html create mode 100644 themes/hugo-book/layouts/_partials/docs/post-meta.html create mode 100644 themes/hugo-book/layouts/_partials/docs/post-prev-next.html create mode 100644 themes/hugo-book/layouts/_partials/docs/prev-next-cache.html create mode 100644 themes/hugo-book/layouts/_partials/docs/prev-next.html create mode 100644 themes/hugo-book/layouts/_partials/docs/search.html create mode 100644 themes/hugo-book/layouts/_partials/docs/taxonomy.html create mode 100644 themes/hugo-book/layouts/_partials/docs/text/template.html create mode 100644 themes/hugo-book/layouts/_partials/docs/title.html create mode 100644 themes/hugo-book/layouts/_partials/docs/toc-show.html create mode 100644 themes/hugo-book/layouts/_partials/docs/toc.html (limited to 'themes/hugo-book/layouts/_partials/docs') 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 @@ +

+ + {{- with .Site.Params.BookLogo -}} + Logo + {{- end -}} + {{ .Site.Title }} + +

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 @@ + +{{ 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 @@ + +{{- $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 @@ +
+ +{{ if and .GitInfo .Site.Params.BookLastChangeLink }} +
+ {{- $date := partial "docs/date" (dict "Date" .Lastmod "Format" .Site.Params.BookDateFormat) -}} + + + {{ $date }} + +
+{{ end }} + +{{ if and .File .Site.Params.BookEditLink }} +
+ + + {{ i18n "Edit this page" }} + +
+{{ end }} + +
+ +{{ partial "docs/prev-next" . }} + +{{ $script := resources.Get "clipboard.js" | resources.Minify }} +{{ with $script.Content }} + +{{ 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 @@ +
+ + +

{{ partial "docs/title" . }}

+ + +
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 @@ + \ 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 @@ + + + + + + + +{{- with .Page.Params.BookHref -}} + +{{- end -}} + +{{- template "_internal/opengraph.html" . -}} + +{{ partial "docs/html-head-title" . }} +{{ partial "docs/html-head-favicon" . }} + +{{- $manifest := resources.Get "manifest.json" | resources.ExecuteAsTemplate "manifest.json" . }} + + + +{{- range .Translations }} + +{{- end -}} + + +{{- $styles := resources.Get "book.scss" | resources.ExecuteAsTemplate "book.scss" . | css.Sass | resources.Minify | resources.Fingerprint }} + +{{- 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 }} + + +{{ end -}} + +{{- if .Site.Params.BookServiceWorker -}} + {{- $swJS := resources.Get "sw-register.js" | resources.ExecuteAsTemplate "sw.js" . | resources.Minify | resources.Fingerprint }} + +{{ end -}} + +{{- template "_internal/google_analytics.html" . -}} + + +{{- with .OutputFormats.Get "rss" -}} + {{ printf `` .Rel .MediaType.Type .Permalink $.Site.Title | safeHTML }} +{{ end -}} + +{{ "" | 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 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 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 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 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 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 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 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 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 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 @@ + +{{ $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 }} + + 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) */}} + +{{ end }} + +{{ define "book-page-link" }}{{/* (dict "Page" .Page "CurrentPage" .CurrentPage) */}} + {{ $current := eq .CurrentPage .Page }} + {{ $ancestor := .Page.IsAncestor .CurrentPage }} + + {{ if .Page.Params.BookCollapseSection }} + + + {{ else if .Page.Params.BookHref }} + + {{- partial "docs/title" .Page -}} + + {{ else if .Page.Content }} + + {{- partial "docs/title" .Page -}} + + {{ else }} + {{- partial "docs/title" .Page -}} + {{ 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 @@ + +{{ if . }} + {{ template "book-menu-hugo" . }} +{{ end }} + +{{ define "book-menu-hugo" }} + +{{ 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 @@ + + + +{{ $script := resources.Get "menu-reset.js" | resources.Minify }} +{{ with $script.Content }} + +{{ 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 -}} +
+ + {{- with .Paginator.Prev }} + + Previous + + {{ end }} + + {{ if gt (len .Paginator.Pagers) 1 }} + + {{- $currentPageNumber := .Paginator.PageNumber -}} + {{- range $pageIndex := (slice -2 -1 0 1 2) -}} + {{- with index $.Paginator.Pagers (add $currentPageNumber $pageIndex -1) -}} + {{ .PageNumber }} + {{- end -}} + {{- end -}} + + {{ end }} + + {{- with .Paginator.Next }} + + Next + + {{ end }} + +
+{{- 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 }} +
+ + {{ partial "docs/date" (dict "Date" . "Format" $.Site.Params.BookDateFormat) }} +
+{{ end }} + +{{ range $taxonomy, $_ := .Site.Taxonomies }} + {{ with $terms := $.GetTerms $taxonomy }} +
+ {{ range $n, $term := $terms }}{{ if $n }}, {{ end }} + {{ $term.Title }} + {{- end }} +
+ {{ 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 @@ +
+ + {{ with .NextInSection }} + + Previous + {{ partial "docs/title" . }} + + {{ end }} + + + {{ with .PrevInSection }} + + {{ partial "docs/title" . }} + Next + + {{ end }} + +
\ 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 }} +
+ + {{ with $prev }} + + Previous + {{ partial "docs/title" . }} + + {{ end }} + + + {{ with $next }} + + {{ partial "docs/title" . }} + Next + + {{ end }} + +
+ {{ 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 }} + + +{{ 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 @@ + 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 @@ + + +{{- $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 @@ + +{{ $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 "")) + (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" . }} -- cgit v1.2.3