huge upgrade to theme and pagefind search bar.
This commit is contained in:
@@ -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="{{ partial "docs/text/i18n" "Logo" }}" />
|
||||
{{- end -}}
|
||||
<span>{{ .Site.Title }}</span>
|
||||
</a>
|
||||
</h2>
|
||||
@@ -0,0 +1,2 @@
|
||||
<!-- This partial can be replaced to support other commenting engines -->
|
||||
{{ partial "disqus.html" . }}
|
||||
@@ -0,0 +1 @@
|
||||
<small>{{ .Site.Title }} - {{ .Site.Copyright | .RenderString }}</small>
|
||||
6
themes/hugo-book.backup/layouts/_partials/docs/date.html
Normal file
6
themes/hugo-book.backup/layouts/_partials/docs/date.html
Normal file
@@ -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) -}}
|
||||
24
themes/hugo-book.backup/layouts/_partials/docs/footer.html
Normal file
24
themes/hugo-book.backup/layouts/_partials/docs/footer.html
Normal file
@@ -0,0 +1,24 @@
|
||||
<div class="flex flex-wrap justify-between">
|
||||
|
||||
<div>
|
||||
{{ if and .GitInfo .Site.Params.BookLastChangeLink }}
|
||||
{{- $date := partial "docs/date" (dict "Date" .Lastmod "Format" .Site.Params.BookDateFormat) -}}
|
||||
<a class="flex align-center" href="{{ partial "docs/links/commit" . }}" title='{{ partial "docs/text/i18n" "Last modified by" }} {{ .GitInfo.AuthorName }} | {{ $date }}' target="_blank" rel="noopener">
|
||||
<img src="{{ partial "docs/icon" "calendar" }}" class="book-icon" alt="{{ partial "docs/text/i18n" "Calendar" }}" />
|
||||
<span>{{ $date }}</span>
|
||||
</a>
|
||||
{{ end }}
|
||||
</div>
|
||||
|
||||
<div>
|
||||
{{ if and .File .Site.Params.BookEditLink }}
|
||||
<a class="flex align-center" href="{{ partial "docs/links/edit" . }}" target="_blank" rel="noopener edit">
|
||||
<img src="{{ partial "docs/icon" "edit" }}" class="book-icon" alt="{{ partial "docs/text/i18n" "Edit" }}" />
|
||||
<span>{{ partial "docs/text/i18n" "Edit this page" }}</span>
|
||||
</a>
|
||||
{{ end }}
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
{{ partial "docs/prev-next" . }}
|
||||
13
themes/hugo-book.backup/layouts/_partials/docs/header.html
Normal file
13
themes/hugo-book.backup/layouts/_partials/docs/header.html
Normal file
@@ -0,0 +1,13 @@
|
||||
<div class="flex align-center justify-between">
|
||||
<label for="menu-control">
|
||||
<img src="{{ partial "docs/icon" "menu" }}" class="book-icon" alt="{{ partial "docs/text/i18n" "Menu" }}" />
|
||||
</label>
|
||||
|
||||
<h3>{{ partial "docs/title" . }}</h3>
|
||||
|
||||
<label for="toc-control">
|
||||
{{ if partial "docs/toc-show" . }}
|
||||
<img src="{{ partial "docs/icon" "toc" }}" class="book-icon" alt="{{ partial "docs/text/i18n" "Table of Contents" }}" />
|
||||
{{ end }}
|
||||
</label>
|
||||
</div>
|
||||
@@ -0,0 +1 @@
|
||||
{{- range $key, $value := . -}} {{- $key | htmlEscape -}}="{{- $value | safeHTMLAttr -}}" {{- end -}}
|
||||
@@ -0,0 +1 @@
|
||||
<link rel="icon" href="{{ .Site.Params.BookFavicon | default "favicon.png" | relURL }}" >
|
||||
@@ -0,0 +1 @@
|
||||
{{ with partial "docs/title" . }}{{ . }} | {{ end }}{{ .Site.Title -}}
|
||||
@@ -0,0 +1,60 @@
|
||||
{{ "<!--" | safeHTML }}
|
||||
Made with Book Theme
|
||||
https://github.com/alex-shpak/hugo-book
|
||||
{{ "-->" | safeHTML }}
|
||||
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<meta name="description" content="{{ or .Description .Summary | plainify | htmlUnescape }}">
|
||||
<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 -}}
|
||||
|
||||
{{ partial "opengraph.html" . }}
|
||||
{{ partial "schema.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="{{ partial "docs/links/resource-precache" $styles }}" {{ template "integrity" $styles }}>
|
||||
|
||||
<!-- Search -->
|
||||
{{- 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="{{ partial "docs/links/resource-precache" $searchJS }}" {{ template "integrity" $searchJS }}></script>
|
||||
{{ end -}}
|
||||
|
||||
<!-- Service Worker -->
|
||||
{{- 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 -}}
|
||||
|
||||
{{ partial "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 -}}
|
||||
|
||||
{{- define "integrity" -}}
|
||||
{{- if (urls.Parse .Permalink).Host -}}
|
||||
integrity="{{ .Data.Integrity }}" crossorigin="anonymous"
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
2
themes/hugo-book.backup/layouts/_partials/docs/icon.html
Normal file
2
themes/hugo-book.backup/layouts/_partials/docs/icon.html
Normal file
@@ -0,0 +1,2 @@
|
||||
{{- $icon := resources.Get (printf "icons/%s.svg" .) -}}
|
||||
{{- return $icon.RelPermalink -}}
|
||||
@@ -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 }}
|
||||
|
||||
<ul class="book-languages">
|
||||
<li>
|
||||
<input type="checkbox" id="languages" class="toggle" />
|
||||
<label for="languages" class="flex">
|
||||
<a role="button">
|
||||
<img src="{{ partial "docs/icon" "translate" }}" class="book-icon" alt="{{ partial "docs/text/i18n" "Languages" }}" />
|
||||
{{ $.Site.Language.LanguageName }}
|
||||
</a>
|
||||
<img src="{{ partial "docs/icon" "chevron-right" }}" class="book-icon" alt="{{ partial "docs/text/i18n" "Expand" }}" />
|
||||
</label>
|
||||
|
||||
<ul>
|
||||
{{ range .Site.Languages }}{{ with index $translations .Lang }}
|
||||
<li>
|
||||
<a href="{{ cond hugo.IsMultihost .Permalink .RelPermalink }}" class="flex flex-auto">
|
||||
{{ .Language.LanguageName }}
|
||||
</a>
|
||||
</li>
|
||||
{{ end }}{{ end }}
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
@@ -0,0 +1,5 @@
|
||||
{{- return (partial "docs/text/template" (dict "Template" .Site.Params.BookLastChangeLink "Context" (dict
|
||||
"Site" .Site
|
||||
"Page" .Page
|
||||
"GitInfo" .GitInfo
|
||||
)) | urls.JoinPath) -}}
|
||||
@@ -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) -}}
|
||||
@@ -0,0 +1,32 @@
|
||||
{{- $destination := .Destination -}}
|
||||
{{- $url := urls.Parse .Destination -}}
|
||||
|
||||
{{- $isRemote := $url.IsAbs -}}
|
||||
{{- $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 -}}
|
||||
{{- $mode := .Page.Site.Params.BookPortableLinks -}}
|
||||
{{- $message := printf "Image reference '%s' not found in '%s'" .Destination .Page.RelPermalink -}}
|
||||
{{- if eq $mode "warning" -}}
|
||||
{{- warnf $message -}}
|
||||
{{- else if eq $mode "error" -}}
|
||||
{{- errorf $message -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- with $url.RawQuery -}}
|
||||
{{- $destination = print $destination "?" . -}}
|
||||
{{- end -}}
|
||||
{{- with $url.Fragment -}}
|
||||
{{- $destination = print $destination "#" . -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- return $destination -}}
|
||||
@@ -0,0 +1,35 @@
|
||||
{{- $destination := .Destination -}}
|
||||
{{- $url := urls.Parse .Destination -}}
|
||||
|
||||
{{- $isRemote := $url.IsAbs -}}
|
||||
{{- $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 -}}
|
||||
{{- $mode := .Page.Site.Params.BookPortableLinks -}}
|
||||
{{- $message := printf "Image reference '%s' not found in '%s'" .Destination .Page.RelPermalink -}}
|
||||
{{- if eq $mode "warning" -}}
|
||||
{{- warnf $message -}}
|
||||
{{- else if eq $mode "error" -}}
|
||||
{{- errorf $message -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- with $url.RawQuery -}}
|
||||
{{- $destination = print $destination "?" . -}}
|
||||
{{- end -}}
|
||||
{{- with $url.Fragment -}}
|
||||
{{- $destination = print $destination "#" . -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- return $destination -}}
|
||||
@@ -0,0 +1,2 @@
|
||||
{{- site.Store.SetInMap "book-sw-precache" .RelPermalink true -}}
|
||||
{{- return .RelPermalink -}}
|
||||
@@ -0,0 +1,59 @@
|
||||
{{ $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="{{ if $current }}active{{ end }}">
|
||||
{{ template "book-icon-title" .Page -}}
|
||||
</a>
|
||||
<img src="{{ partial "docs/icon" "chevron-right" }}" class="book-icon" alt="{{ partial "docs/text/i18n" "Expand" }}" />
|
||||
</label>
|
||||
{{ else if .Page.Params.BookHref }}
|
||||
<a href="{{ .Page.Params.BookHref }}" class="{{ if $current }}active{{ end }}" target="_blank" rel="noopener">
|
||||
{{ template "book-icon-title" .Page -}}
|
||||
</a>
|
||||
{{ else if .Page.Content }}
|
||||
<a href="{{ .Page.RelPermalink }}" class="{{ if $current }}active{{ end }}">
|
||||
{{ template "book-icon-title" .Page -}}
|
||||
</a>
|
||||
{{ else }}
|
||||
<a>
|
||||
{{ template "book-icon-title" .Page -}}
|
||||
</a>
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
|
||||
{{ define "book-icon-title" }}
|
||||
{{- with .Page.Params.BookIcon -}}
|
||||
<img src="{{ partial "docs/icon" . }}" class="book-icon" alt="{{ partial "docs/text/i18n" . }}" />
|
||||
{{- end -}}
|
||||
{{- partial "docs/title" .Page -}}
|
||||
{{ end }}
|
||||
@@ -0,0 +1,46 @@
|
||||
<!--
|
||||
This is template for hugo menus, accepts Page and Menu as context
|
||||
https://gohugo.io/variables/menus/
|
||||
-->
|
||||
{{- if .Menu -}}
|
||||
{{- template "book-menu-hugo" . -}}
|
||||
{{- end -}}
|
||||
|
||||
{{ define "book-menu-hugo" }}
|
||||
<ul>
|
||||
{{- range .Menu -}}
|
||||
{{- $class := slice -}}
|
||||
{{- with .Params.class -}}
|
||||
{{- $class = $class | append . -}}
|
||||
{{- end -}}
|
||||
{{- if $.Page.IsMenuCurrent .Menu . -}}
|
||||
{{- $class = $class | append "active" -}}
|
||||
{{- end -}}
|
||||
<li>
|
||||
{{- $isRemote := (urls.Parse .URL).IsAbs -}}
|
||||
<a href="{{ .URL }}"
|
||||
{{- with $class }} class="{{ delimit . " " }}"{{- end -}}
|
||||
{{- with .Title }} title="{{ . }}"{{- end -}}
|
||||
{{- if $isRemote }} target="_blank" rel="noopener"{{- end -}}>
|
||||
{{- .Pre -}}
|
||||
{{- template "book-menu-title" . -}}
|
||||
{{- .Post -}}
|
||||
</a>
|
||||
{{- with .Children -}}
|
||||
{{- template "book-menu-hugo" (dict "Page" $.Page "Menu" .) -}}
|
||||
{{- end -}}
|
||||
</li>
|
||||
{{- end -}}
|
||||
</ul>
|
||||
{{ end }}
|
||||
|
||||
{{ define "book-menu-title" }}
|
||||
{{- with .Params.BookIcon -}}
|
||||
<img src="{{ partial "docs/icon" . }}" class="book-icon" alt="{{ partial "docs/text/i18n" . }}" />
|
||||
{{- end -}}
|
||||
{{- if .Name -}}
|
||||
{{- .Name -}}
|
||||
{{- else if .Page -}}
|
||||
{{- partial "docs/title" .Page -}}
|
||||
{{- end -}}
|
||||
{{ end }}
|
||||
21
themes/hugo-book.backup/layouts/_partials/docs/menu.html
Normal file
21
themes/hugo-book.backup/layouts/_partials/docs/menu.html
Normal file
@@ -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" (dict "Page" .Page "Menu" .Site.Menus.before) }}
|
||||
|
||||
{{ partial "docs/menu-filetree" . }}
|
||||
|
||||
{{ partial "docs/menu-hugo" (dict "Page" .Page "Menu" .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 }}
|
||||
@@ -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="{{ partial "docs/icon" "backward" }}" class="book-icon" alt="{{ partial "docs/text/i18n" "Backward" }}" />
|
||||
</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="{{ partial "docs/icon" "forward" }}" class="book-icon" alt="{{ partial "docs/text/i18n" "Forward" }}" />
|
||||
</a>
|
||||
{{ end }}
|
||||
</span>
|
||||
</div>
|
||||
{{- end -}}
|
||||
@@ -0,0 +1,16 @@
|
||||
{{ with .Date }}
|
||||
<div class="flex align-center text-small book-post-date">
|
||||
<img src="{{ partial "docs/icon" "calendar" }}" class="book-icon" alt="{{ partial "docs/text/i18n" "Calendar" }}" />
|
||||
<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 }}
|
||||
@@ -0,0 +1,18 @@
|
||||
<div class="flex flex-wrap justify-between">
|
||||
<div>
|
||||
{{ with .NextInSection }}
|
||||
<a href="{{ .RelPermalink }}" class="flex align-center">
|
||||
<img src="{{ partial "docs/icon" "backward" }}" class="book-icon" alt="{{ partial "docs/text/i18n" "Backward" }}" />
|
||||
<span>{{ partial "docs/title" . }}</span>
|
||||
</a>
|
||||
{{ end }}
|
||||
</div>
|
||||
<div>
|
||||
{{ with .PrevInSection }}
|
||||
<a href="{{ .RelPermalink }}" class="flex align-center">
|
||||
<span>{{ partial "docs/title" . }}</span>
|
||||
<img src="{{ partial "docs/icon" "forward" }}" class="book-icon" alt="{{ partial "docs/text/i18n" "Forward" }}" />
|
||||
</a>
|
||||
{{ end }}
|
||||
</div>
|
||||
</div>
|
||||
@@ -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" }}
|
||||
@@ -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="{{ partial "docs/icon" "backward" }}" class="book-icon" alt="{{ partial "docs/text/i18n" "Backward" }}" />
|
||||
<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="{{ partial "docs/icon" "forward" }}" class="book-icon" alt="{{ partial "docs/text/i18n" "Forward" }}" />
|
||||
</a>
|
||||
{{ end }}
|
||||
</span>
|
||||
</div>
|
||||
{{ end -}}
|
||||
{{ end }}
|
||||
10
themes/hugo-book.backup/layouts/_partials/docs/search.html
Normal file
10
themes/hugo-book.backup/layouts/_partials/docs/search.html
Normal file
@@ -0,0 +1,10 @@
|
||||
{{ if default true .Site.Params.BookSearch }}
|
||||
<link href="/pagefind/pagefind-ui.css" rel="stylesheet">
|
||||
<script src="/pagefind/pagefind-ui.js"></script>
|
||||
<div id="search"></div>
|
||||
<script>
|
||||
window.addEventListener('DOMContentLoaded', (event) => {
|
||||
new PagefindUI({ element: "#search", showSubResults: true });
|
||||
});
|
||||
</script>
|
||||
{{ end }}
|
||||
@@ -0,0 +1,22 @@
|
||||
<!-- /* {{ if default true .Site.Params.BookSearch }} */ -->
|
||||
<!-- /* <div class="book-search hidden"> */ -->
|
||||
<!-- /* <input id="book-search-input" type="text" */ -->
|
||||
<!-- /* placeholder="{{ partial "docs/text/i18n" "SearchY" }}" */ -->
|
||||
<!-- /* aria-label="{{ partial "docs/text/i18n" "SearchZ" }}" */ -->
|
||||
<!-- /* 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 }} */ -->
|
||||
|
||||
<!-- {{ if default true .Site.Params.BookSearch }} -->
|
||||
<!-- <link href="/pagefind/pagefind-ui.css" rel="stylesheet"> -->
|
||||
<!-- <script src="/pagefind/pagefind-ui.js"></script> -->
|
||||
<!-- <div id="search"></div> -->
|
||||
<!-- <script> -->
|
||||
<!-- window.addEventListener('DOMContentLoaded', (event) => { -->
|
||||
<!-- new PagefindUI({ element: "#search", showSubResults: true }); -->
|
||||
<!-- }); -->
|
||||
<!-- </script> -->
|
||||
<!-- {{ end }} -->
|
||||
19
themes/hugo-book.backup/layouts/_partials/docs/taxonomy.html
Normal file
19
themes/hugo-book.backup/layouts/_partials/docs/taxonomy.html
Normal file
@@ -0,0 +1,19 @@
|
||||
<nav>
|
||||
<ul>
|
||||
{{ range $term, $_ := .Site.Taxonomies }}
|
||||
{{ with $.Site.GetPage (printf "/%s" $term | urlize) }}
|
||||
<li class="book-section-flat">
|
||||
<a>{{ partial "docs/text/i18n" .Title }}</a>
|
||||
<ul>
|
||||
{{ range .Pages }}
|
||||
<li class="flex align-center">
|
||||
<a href="{{ .RelPermalink }}">{{ .Title }}</a>
|
||||
<span>{{ len .Pages }}</span>
|
||||
</li>
|
||||
{{ end }}
|
||||
</ul>
|
||||
</li>
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
</ul>
|
||||
</nav>
|
||||
@@ -0,0 +1 @@
|
||||
{{- return or (i18n .) . -}}
|
||||
@@ -0,0 +1,36 @@
|
||||
{{- /*
|
||||
This is generic function the helps modifying and merging dictionaries, usually used for html attributes
|
||||
Logic is executed in order defined below.
|
||||
partial "docs/text/mapper" (dict
|
||||
"attributes" (cond .IsNamedParams .Params dict)
|
||||
"keep" (slice "id" "class" "tabindex" "alt" "title" "loading")
|
||||
"set" (dict "href" "https://")
|
||||
"merge" (dict "class" "a-class")
|
||||
"delimiter" " " // Used when merging values
|
||||
"delete" (slice "src")
|
||||
)
|
||||
*/ -}}
|
||||
|
||||
{{- $store := newScratch -}}
|
||||
{{- $allowlist := or (.keep) (slice "id" "class" "tabindex" "dir")}}
|
||||
{{- range $key, $value := .attributes -}}
|
||||
{{- if in $allowlist $key -}}
|
||||
{{- $store.Set $key $value -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- range $key, $value := .set -}}
|
||||
{{- $store.Set $key (print $value) -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- range $key, $value := .merge -}}
|
||||
{{- $merged := (slice) | append $value | append (or (index $.attributes $key) (slice)) -}}
|
||||
{{- $delimiter := or ($.delimiter) (" ") }}
|
||||
{{- $store.Set $key (delimit $merged $delimiter) -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- range $key := .delete -}}
|
||||
{{- $store.Delete $key -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- return $store.Values -}}
|
||||
@@ -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 -}}
|
||||
17
themes/hugo-book.backup/layouts/_partials/docs/title.html
Normal file
17
themes/hugo-book.backup/layouts/_partials/docs/title.html
Normal file
@@ -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 }}
|
||||
@@ -0,0 +1,5 @@
|
||||
{{- return and
|
||||
(not (eq .Params.bookToC false))
|
||||
(not (eq .Site.Params.BookToC false))
|
||||
(not (eq .TableOfContents "<nav id=\"TableOfContents\"></nav>"))
|
||||
-}}
|
||||
3
themes/hugo-book.backup/layouts/_partials/docs/toc.html
Normal file
3
themes/hugo-book.backup/layouts/_partials/docs/toc.html
Normal file
@@ -0,0 +1,3 @@
|
||||
{{ partial "docs/inject/toc-before" . }}
|
||||
{{ .TableOfContents }}
|
||||
{{ partial "docs/inject/toc-after" . }}
|
||||
Reference in New Issue
Block a user