A lot of small changes improving keyboard navigation, readability and accesibility

This commit is contained in:
Alex Shpak
2025-10-09 22:58:13 +02:00
parent 0593f02604
commit 6baf098e54
27 changed files with 95 additions and 101 deletions
+8 -17
View File
@@ -43,7 +43,7 @@ small {
@extend .text-small; @extend .text-small;
} }
:focus { :focus-visible, input.toggle:focus-visible + label {
@include outline; @include outline;
} }
@@ -57,7 +57,7 @@ nav ul {
} }
a { a {
padding: .5em 0; padding: 0.5em 0;
display: flex; display: flex;
transition: opacity 0.1s ease-in-out; transition: opacity 0.1s ease-in-out;
} }
@@ -154,12 +154,12 @@ a .book-icon {
// for RTL support // for RTL support
body[dir="rtl"] .book-menu { body[dir="rtl"] .book-menu {
input.toggle + label::after { input.toggle + label > img:last-child {
content: ""; transform: rotate(180deg);
} }
input.toggle:checked + label::after { input.toggle:checked + label > img:last-child {
transform: rotate(-90deg); transform: rotate(90deg);
} }
} }
@@ -241,7 +241,7 @@ body[dir="rtl"] .book-menu {
padding: 0; padding: 0;
} }
&:hover > ul { &:hover > ul, &:focus-within > ul {
display: block; display: block;
} }
} }
@@ -251,13 +251,12 @@ body[dir="rtl"] .book-menu {
.book-search { .book-search {
position: relative; position: relative;
margin: $padding-8 0; margin: $padding-8 0;
border-bottom: 1px solid transparent;
input { input {
width: 100%; width: 100%;
padding: $padding-8; padding: $padding-8;
border: 0; border: $padding-1 solid var(--gray-200);
border-radius: var(--border-radius); border-radius: var(--border-radius);
background: var(--gray-100); background: var(--gray-100);
@@ -384,10 +383,6 @@ body[dir="rtl"] .book-menu {
display: inline; display: inline;
} }
#menu-control:focus ~ main label[for="menu-control"] {
@include outline;
}
#menu-control:checked ~ main { #menu-control:checked ~ main {
.book-menu { .book-menu {
visibility: initial; visibility: initial;
@@ -412,10 +407,6 @@ body[dir="rtl"] .book-menu {
} }
} }
#toc-control:focus ~ main label[for="toc-control"] {
@include outline;
}
#toc-control:checked ~ main { #toc-control:checked ~ main {
.book-header aside { .book-header aside {
display: block; display: block;
+19 -4
View File
@@ -25,8 +25,7 @@
margin-inline-start: .25em; margin-inline-start: .25em;
} }
&:hover a.anchor, &:hover a.anchor, a.anchor:focus-visible {
a.anchor:focus {
opacity: initial; opacity: initial;
text-decoration: none; text-decoration: none;
} }
@@ -64,8 +63,9 @@
code { code {
direction: ltr; direction: ltr;
unicode-bidi: embed; unicode-bidi: embed;
padding: 0 $padding-4; padding: .125em .25em;
background: var(--gray-200); background: var(--gray-100);
border: $padding-1 solid var(--gray-200);
border-radius: var(--border-radius); border-radius: var(--border-radius);
font-size: 0.875em; font-size: 0.875em;
} }
@@ -73,11 +73,17 @@
pre { pre {
padding: $padding-16; padding: $padding-16;
background: var(--gray-100); background: var(--gray-100);
border: $padding-1 solid var(--gray-200);
border-radius: var(--border-radius); border-radius: var(--border-radius);
overflow-x: auto; overflow-x: auto;
&:focus {
@include outline;
}
code { code {
padding: 0; padding: 0;
border: 0;
background: none; background: none;
} }
} }
@@ -151,7 +157,15 @@
unicode-bidi: embed; unicode-bidi: embed;
border-radius: var(--border-radius); border-radius: var(--border-radius);
table tbody {
border: $padding-1 solid var(--gray-200);
}
table tr { table tr {
pre {
border: 0;
}
td pre code > span { td pre code > span {
display: flex; display: flex;
} }
@@ -160,6 +174,7 @@
margin: 0; margin: 0;
padding-inline-end: 0; padding-inline-end: 0;
} }
td:nth-child(2) pre { td:nth-child(2) pre {
margin: 0; margin: 0;
padding-inline-start: 0; padding-inline-start: 0;
+5 -9
View File
@@ -8,8 +8,6 @@
border: $padding-1 solid var(--gray-200); border: $padding-1 solid var(--gray-200);
border-radius: var(--border-radius); border-radius: var(--border-radius);
overflow: hidden;
display: flex; display: flex;
flex-wrap: wrap; flex-wrap: wrap;
@@ -35,10 +33,6 @@
input[type="radio"]:checked+label+.book-tabs-content { input[type="radio"]:checked+label+.book-tabs-content {
display: block; display: block;
} }
input[type="radio"]:focus+label {
@include outline;
}
} }
// {{< columns >}} // {{< columns >}}
@@ -99,7 +93,7 @@
display: inline-block; display: inline-block;
font-size: var(--font-size-smaller); font-size: var(--font-size-smaller);
font-weight: var(body-font-weight); font-weight: var(--body-font-weight);
vertical-align: middle; vertical-align: middle;
border-radius: var(--border-radius); border-radius: var(--border-radius);
border: $padding-1 solid var(--accent-color); border: $padding-1 solid var(--accent-color);
@@ -238,10 +232,12 @@
} }
.book-codeblock-filename { .book-codeblock-filename {
background: var(--gray-200); background: var(--gray-100);
border: $padding-1 solid var(--gray-200);
border-bottom: 0;
font-size: var(--font-size-smaller); font-size: var(--font-size-smaller);
margin-top: $padding-16; margin-top: $padding-16;
padding: $padding-4 $padding-16; padding: $padding-4 $padding-8;
border-start-start-radius: var(--border-radius); border-start-start-radius: var(--border-radius);
border-start-end-radius: var(--border-radius); border-start-end-radius: var(--border-radius);
+1 -2
View File
@@ -89,6 +89,5 @@ input.toggle {
@mixin outline { @mixin outline {
outline-style: auto; outline-style: auto;
outline-color: currentColor; outline-color: var(--color-link);
outline-color: -webkit-focus-ring-color;
} }
+6 -18
View File
@@ -1,23 +1,11 @@
(function () { (function () {
function select(element) { document.querySelectorAll("pre:has(code)").forEach(code => {
const selection = window.getSelection(); code.addEventListener("click", code.focus);
code.addEventListener("copy", function (event) {
const range = document.createRange(); event.preventDefault();
range.selectNodeContents(element);
selection.removeAllRanges();
selection.addRange(range);
}
document.querySelectorAll("pre code").forEach(code => {
code.addEventListener("click", function (event) {
if (window.getSelection().toString()) {
return;
}
select(code.parentElement);
if (navigator.clipboard) { if (navigator.clipboard) {
navigator.clipboard.writeText(code.parentElement.textContent); const content = window.getSelection().toString() || code.textContent;
navigator.clipboard.writeText(content);
} }
}); });
}); });
+1 -1
View File
@@ -10,7 +10,7 @@
"id": {{ $index }}, "id": {{ $index }},
"href": "{{ $page.RelPermalink }}", "href": "{{ $page.RelPermalink }}",
"title": {{ (partial "docs/title" $page) | jsonify }}, "title": {{ (partial "docs/title" $page) | jsonify }},
"section": {{ (partial "docs/title" $page.Parent) | jsonify }}, "section": {{ (partial "docs/title" $page.Parent) | default $.Site.Title | jsonify }},
"content": {{ $page.Plain | jsonify }} "content": {{ $page.Plain | jsonify }}
} }
{{- end -}} {{- end -}}
+1 -1
View File
@@ -1,7 +1,7 @@
<h2 class="book-brand"> <h2 class="book-brand">
<a class="flex align-center" href="{{ cond (not .Site.Home.File) .Sites.Default.Home.RelPermalink .Site.Home.RelPermalink }}"> <a class="flex align-center" href="{{ cond (not .Site.Home.File) .Sites.Default.Home.RelPermalink .Site.Home.RelPermalink }}">
{{- with .Site.Params.BookLogo -}} {{- with .Site.Params.BookLogo -}}
<img src="{{ . | relURL }}" alt="Logo" /> <img src="{{ . | relURL }}" alt="{{ partial "docs/text/i18n" "Logo" }}" />
{{- end -}} {{- end -}}
<span>{{ .Site.Title }}</span> <span>{{ .Site.Title }}</span>
</a> </a>
+4 -9
View File
@@ -3,8 +3,8 @@
<div> <div>
{{ if and .GitInfo .Site.Params.BookLastChangeLink }} {{ if and .GitInfo .Site.Params.BookLastChangeLink }}
{{- $date := partial "docs/date" (dict "Date" .Lastmod "Format" .Site.Params.BookDateFormat) -}} {{- $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"> <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="" /> <img src="{{ partial "docs/icon" "calendar" }}" class="book-icon" alt="{{ partial "docs/text/i18n" "Calendar" }}" />
<span>{{ $date }}</span> <span>{{ $date }}</span>
</a> </a>
{{ end }} {{ end }}
@@ -13,8 +13,8 @@
<div> <div>
{{ if and .File .Site.Params.BookEditLink }} {{ if and .File .Site.Params.BookEditLink }}
<a class="flex align-center" href="{{ partial "docs/links/edit" . }}" target="_blank" rel="noopener edit"> <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="" /> <img src="{{ partial "docs/icon" "edit" }}" class="book-icon" alt="{{ partial "docs/text/i18n" "Edit" }}" />
<span>{{ i18n "Edit this page" }}</span> <span>{{ partial "docs/text/i18n" "Edit this page" }}</span>
</a> </a>
{{ end }} {{ end }}
</div> </div>
@@ -22,8 +22,3 @@
</div> </div>
{{ partial "docs/prev-next" . }} {{ partial "docs/prev-next" . }}
{{ $script := resources.Get "clipboard.js" | resources.Minify }}
{{ with $script.Content }}
<script>{{ . | safeJS }}</script>
{{ end }}
+2 -2
View File
@@ -1,13 +1,13 @@
<div class="flex align-center justify-between"> <div class="flex align-center justify-between">
<label for="menu-control"> <label for="menu-control">
<img src="{{ partial "docs/icon" "menu" }}" class="book-icon" alt="Menu" /> <img src="{{ partial "docs/icon" "menu" }}" class="book-icon" alt="{{ partial "docs/text/i18n" "Menu" }}" />
</label> </label>
<h3>{{ partial "docs/title" . }}</h3> <h3>{{ partial "docs/title" . }}</h3>
<label for="toc-control"> <label for="toc-control">
{{ if partial "docs/toc-show" . }} {{ if partial "docs/toc-show" . }}
<img src="{{ partial "docs/icon" "toc" }}" class="book-icon" alt="Table of Contents" /> <img src="{{ partial "docs/icon" "toc" }}" class="book-icon" alt="{{ partial "docs/text/i18n" "Table of Contents" }}" />
{{ end }} {{ end }}
</label> </label>
</div> </div>
+2 -1
View File
@@ -5,7 +5,7 @@ https://github.com/alex-shpak/hugo-book
<meta charset="UTF-8"> <meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="{{ default .Summary .Description }}"> <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: light)" content="#ffffff">
<meta name="theme-color" media="(prefers-color-scheme: dark)" content="#343a40"> <meta name="theme-color" media="(prefers-color-scheme: dark)" content="#343a40">
<meta name="color-scheme" content="light dark"> <meta name="color-scheme" content="light dark">
@@ -15,6 +15,7 @@ https://github.com/alex-shpak/hugo-book
{{- end -}} {{- end -}}
{{ partial "opengraph.html" . }} {{ partial "opengraph.html" . }}
{{ partial "schema.html" . }}
<title>{{ partial "docs/html-head-title" . }}</title> <title>{{ partial "docs/html-head-title" . }}</title>
{{ partial "docs/html-head-favicon" . }} {{ partial "docs/html-head-favicon" . }}
+2 -3
View File
@@ -1,3 +1,2 @@
{{- with resources.Get (printf "icons/%s.svg" .) -}} {{- $icon := resources.Get (printf "icons/%s.svg" .) -}}
{{- .RelPermalink -}} {{- return $icon.RelPermalink -}}
{{- end -}}
+2 -2
View File
@@ -14,10 +14,10 @@
<input type="checkbox" id="languages" class="toggle" /> <input type="checkbox" id="languages" class="toggle" />
<label for="languages" class="flex"> <label for="languages" class="flex">
<a role="button"> <a role="button">
<img src="{{ partial "docs/icon" "translate" }}" class="book-icon" alt="Languages" /> <img src="{{ partial "docs/icon" "translate" }}" class="book-icon" alt="{{ partial "docs/text/i18n" "Languages" }}" />
{{ $.Site.Language.LanguageName }} {{ $.Site.Language.LanguageName }}
</a> </a>
<img src="{{ partial "docs/icon" "chevron-right" }}" class="book-icon" /> <img src="{{ partial "docs/icon" "chevron-right" }}" class="book-icon" alt="{{ partial "docs/text/i18n" "Expand" }}" />
</label> </label>
<ul> <ul>
+3 -3
View File
@@ -1,4 +1,4 @@
{{ $bookSection := default "docs" .Site.Params.BookSection }} {{ $bookSection := default "docs" .Site.Params.BookSection }}
{{ if eq $bookSection "*" }} {{ if eq $bookSection "*" }}
{{ $bookSection = "/" }}{{/* Backward compatibility */}} {{ $bookSection = "/" }}{{/* Backward compatibility */}}
{{ end }} {{ end }}
@@ -34,7 +34,7 @@
<a {{ if .Page.Content }}href="{{ .Page.RelPermalink }}"{{ else }}role="button"{{ end }} class="{{ if $current }}active{{ end }}"> <a {{ if .Page.Content }}href="{{ .Page.RelPermalink }}"{{ else }}role="button"{{ end }} class="{{ if $current }}active{{ end }}">
{{ template "book-icon-title" .Page -}} {{ template "book-icon-title" .Page -}}
</a> </a>
<img src="{{ partial "docs/icon" "chevron-right" }}" class="book-icon" /> <img src="{{ partial "docs/icon" "chevron-right" }}" class="book-icon" alt="{{ partial "docs/text/i18n" "Expand" }}" />
</label> </label>
{{ else if .Page.Params.BookHref }} {{ else if .Page.Params.BookHref }}
<a href="{{ .Page.Params.BookHref }}" class="{{ if $current }}active{{ end }}" target="_blank" rel="noopener"> <a href="{{ .Page.Params.BookHref }}" class="{{ if $current }}active{{ end }}" target="_blank" rel="noopener">
@@ -53,7 +53,7 @@
{{ define "book-icon-title" }} {{ define "book-icon-title" }}
{{- with .Page.Params.BookIcon -}} {{- with .Page.Params.BookIcon -}}
<img src="{{ partial "docs/icon" . }}" class="book-icon" /> <img src="{{ partial "docs/icon" . }}" class="book-icon" alt="{{ partial "docs/text/i18n" . }}" />
{{- end -}} {{- end -}}
{{- partial "docs/title" .Page -}} {{- partial "docs/title" .Page -}}
{{ end }} {{ end }}
+1 -1
View File
@@ -36,7 +36,7 @@
{{ define "book-menu-title" }} {{ define "book-menu-title" }}
{{- with .Params.BookIcon -}} {{- with .Params.BookIcon -}}
<img src="{{ partial "docs/icon" . }}" class="book-icon" /> <img src="{{ partial "docs/icon" . }}" class="book-icon" alt="{{ partial "docs/text/i18n" . }}" />
{{- end -}} {{- end -}}
{{- if .Name -}} {{- if .Name -}}
{{- .Name -}} {{- .Name -}}
+2 -2
View File
@@ -3,7 +3,7 @@
<span> <span>
{{- with .Paginator.Prev }} {{- with .Paginator.Prev }}
<a href="{{ .URL }}" class="flex align-center"> <a href="{{ .URL }}" class="flex align-center">
<img src="{{ partial "docs/icon" "backward" }}" class="book-icon" alt="Previous" /> <img src="{{ partial "docs/icon" "backward" }}" class="book-icon" alt="{{ partial "docs/text/i18n" "Backward" }}" />
</a> </a>
{{ end }} {{ end }}
</span> </span>
@@ -20,7 +20,7 @@
<span> <span>
{{- with .Paginator.Next }} {{- with .Paginator.Next }}
<a href="{{ .URL }}" class="flex align-center"> <a href="{{ .URL }}" class="flex align-center">
<img src="{{ partial "docs/icon" "forward" }}" class="book-icon" alt="Next" /> <img src="{{ partial "docs/icon" "forward" }}" class="book-icon" alt="{{ partial "docs/text/i18n" "Forward" }}" />
</a> </a>
{{ end }} {{ end }}
</span> </span>
+1 -1
View File
@@ -1,6 +1,6 @@
{{ with .Date }} {{ with .Date }}
<div class="flex align-center text-small book-post-date"> <div class="flex align-center text-small book-post-date">
<img src="{{ partial "docs/icon" "calendar" }}" class="book-icon" alt="" /> <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> <span>{{ partial "docs/date" (dict "Date" . "Format" $.Site.Params.BookDateFormat) }}</span>
</div> </div>
{{ end }} {{ end }}
+2 -2
View File
@@ -2,7 +2,7 @@
<div> <div>
{{ with .NextInSection }} {{ with .NextInSection }}
<a href="{{ .RelPermalink }}" class="flex align-center"> <a href="{{ .RelPermalink }}" class="flex align-center">
<img src="{{ partial "docs/icon" "backward" }}" class="book-icon" alt="Previous" title="{{ partial "docs/title" . }}" /> <img src="{{ partial "docs/icon" "backward" }}" class="book-icon" alt="{{ partial "docs/text/i18n" "Backward" }}" />
<span>{{ partial "docs/title" . }}</span> <span>{{ partial "docs/title" . }}</span>
</a> </a>
{{ end }} {{ end }}
@@ -11,7 +11,7 @@
{{ with .PrevInSection }} {{ with .PrevInSection }}
<a href="{{ .RelPermalink }}" class="flex align-center"> <a href="{{ .RelPermalink }}" class="flex align-center">
<span>{{ partial "docs/title" . }}</span> <span>{{ partial "docs/title" . }}</span>
<img src="{{ partial "docs/icon" "forward" }}" class="book-icon" alt="Next" title="{{ partial "docs/title" . }}" /> <img src="{{ partial "docs/icon" "forward" }}" class="book-icon" alt="{{ partial "docs/text/i18n" "Forward" }}" />
</a> </a>
{{ end }} {{ end }}
</div> </div>
+2 -2
View File
@@ -13,7 +13,7 @@
<span> <span>
{{ with $prev }} {{ with $prev }}
<a href="{{ .RelPermalink }}" class="flex align-center"> <a href="{{ .RelPermalink }}" class="flex align-center">
<img src="{{ partial "docs/icon" "backward" }}" class="book-icon" alt="Previous" title="{{ partial "docs/title" . }}" /> <img src="{{ partial "docs/icon" "backward" }}" class="book-icon" alt="{{ partial "docs/text/i18n" "Backward" }}" />
<span>{{ partial "docs/title" . }}</span> <span>{{ partial "docs/title" . }}</span>
</a> </a>
{{ end }} {{ end }}
@@ -22,7 +22,7 @@
{{ with $next }} {{ with $next }}
<a href="{{ .RelPermalink }}" class="flex align-center"> <a href="{{ .RelPermalink }}" class="flex align-center">
<span>{{ partial "docs/title" . }}</span> <span>{{ partial "docs/title" . }}</span>
<img src="{{ partial "docs/icon" "forward" }}" class="book-icon" alt="Next" title="{{ partial "docs/title" . }}" /> <img src="{{ partial "docs/icon" "forward" }}" class="book-icon" alt="{{ partial "docs/text/i18n" "Forward" }}" />
</a> </a>
{{ end }} {{ end }}
</span> </span>
+4 -2
View File
@@ -1,9 +1,11 @@
{{ if default true .Site.Params.BookSearch }} {{ if default true .Site.Params.BookSearch }}
<div class="book-search hidden"> <div class="book-search hidden">
<input type="text" id="book-search-input" placeholder="{{ i18n "Search" }}" aria-label="{{ i18n "Search" }}" maxlength="64" data-hotkeys="s/" /> <input id="book-search-input" type="text"
placeholder="{{ partial "docs/text/i18n" "Search" }}"
aria-label="{{ partial "docs/text/i18n" "Search" }}"
maxlength="64" data-hotkeys="s/" />
<div class="book-search-spinner hidden"></div> <div class="book-search-spinner hidden"></div>
<ul id="book-search-results"></ul> <ul id="book-search-results"></ul>
</div> </div>
<script>document.querySelector(".book-search").classList.remove("hidden")</script> <script>document.querySelector(".book-search").classList.remove("hidden")</script>
{{ end }} {{ end }}
+1 -1
View File
@@ -3,7 +3,7 @@
{{ range $term, $_ := .Site.Taxonomies }} {{ range $term, $_ := .Site.Taxonomies }}
{{ with $.Site.GetPage (printf "/%s" $term | urlize) }} {{ with $.Site.GetPage (printf "/%s" $term | urlize) }}
<li class="book-section-flat"> <li class="book-section-flat">
<a>{{ T .Title | default .Title }}</a> <a>{{ partial "docs/text/i18n" .Title }}</a>
<ul> <ul>
{{ range .Pages }} {{ range .Pages }}
<li class="flex align-center"> <li class="flex align-center">
+1
View File
@@ -0,0 +1 @@
{{- return or (i18n .) . -}}
+1 -1
View File
@@ -12,7 +12,7 @@
{{- define "book-card-content" -}} {{- define "book-card-content" -}}
{{- with .Get "image" -}} {{- with .Get "image" -}}
{{- $destination := partial "docs/links/portable-image" (dict "Page" $.Page "Destination" .) -}} {{- $destination := partial "docs/links/portable-image" (dict "Page" $.Page "Destination" .) -}}
<img src="{{ $destination | safeURL }}" /> <img src="{{ $destination | safeURL }}" alt="{{ partial "docs/text/i18n" ($.Get "alt" ) }}" />
{{- end -}} {{- end -}}
<div class="markdown-inner"> <div class="markdown-inner">
{{ with .Inner }}{{ . }}{{ end -}} {{ with .Inner }}{{ . }}{{ end -}}
+1 -2
View File
@@ -1,2 +1 @@
{{- $content := .Get 0 -}} {{- partial "docs/text/i18n" (.Get 0) -}}
{{- default $content (i18n $content) -}}
+1 -1
View File
@@ -6,7 +6,7 @@
</dt> </dt>
{{ if (in $.Params "summary") -}} {{ if (in $.Params "summary") -}}
<dd class="markdown-inner"> <dd class="markdown-inner">
{{ default .Summary .Description }} {{- or .Description .Summary site.Params.description | plainify | htmlUnescape }}
</dd> </dd>
{{ end -}} {{ end -}}
{{ end }} {{ end }}
+20 -12
View File
@@ -24,6 +24,7 @@
{{ template "comments" . }} <!-- Comments block --> {{ template "comments" . }} <!-- Comments block -->
{{ partial "docs/inject/footer" . }} {{ partial "docs/inject/footer" . }}
{{ template "copyright" . }} <!-- Copyright block --> {{ template "copyright" . }} <!-- Copyright block -->
{{ template "clipboard" . }}
</footer> </footer>
<label for="menu-control" class="hidden book-menu-overlay"></label> <label for="menu-control" class="hidden book-menu-overlay"></label>
@@ -62,12 +63,19 @@
{{ partial "docs/footer" . }} {{ partial "docs/footer" . }}
{{ end }} {{ end }}
{{ define "copyright" }} {{ define "clipboard" }}
{{ if .Site.Copyright }} <!-- Clipboard -->
<div class="book-copyright flex justify-center"> {{ with resources.Get "clipboard.js" | resources.Minify }}
{{ partial "docs/copyright" . }} <script>{{ .Content | safeJS }}</script>
</div> {{ end }}
{{ end }} {{ end }}
{{ define "copyright" }}
{{ if .Site.Copyright }}
<div class="book-copyright flex justify-center">
{{ partial "docs/copyright" . }}
</div>
{{ end }}
{{ end }} {{ end }}
{{ define "comments" }} {{ define "comments" }}
@@ -85,13 +93,13 @@
{{ end }} {{ end }}
{{ define "toc-container" }} {{ define "toc-container" }}
{{ if partial "docs/toc-show" . }} {{ if partial "docs/toc-show" . }}
<aside class="book-toc"> <aside class="book-toc">
<div class="book-toc-content"> <div class="book-toc-content">
{{ template "toc" . }} {{ template "toc" . }}
</div> </div>
</aside> </aside>
{{ end }} {{ end }}
{{ end }} {{ end }}
{{ define "toc" }} {{ define "toc" }}
+1 -1
View File
@@ -14,7 +14,7 @@
{{- $thumbnail := default "thumbnail.*" .Params.BookPostThumbnail -}} {{- $thumbnail := default "thumbnail.*" .Params.BookPostThumbnail -}}
{{- with or (.Resources.GetMatch $thumbnail) (resources.GetMatch $thumbnail) -}} {{- with or (.Resources.GetMatch $thumbnail) (resources.GetMatch $thumbnail) -}}
<div class="book-post-thumbnail"> <div class="book-post-thumbnail">
<img src="{{ .RelPermalink }}" /> <img src="{{ .RelPermalink }}" alt="{{ partial "docs/text/i18n" "Thumbnail" }}" />
</div> </div>
{{- end -}} {{- end -}}
</div> </div>