Remove the legacy Fuse.js search from html-head.html (it double-loaded
with the new Pagefind UI; backup kept at html-head.html.bkup) and add a
Pagefind Default-UI partial (search.html) injected into the sidebar via
menu.html.
Index scoping: tag the article element with data-pagefind-body in
baseof.html, term.html, and posts/{single,list}.html so Pagefind indexes
page content only (pages without the tag are skipped; 404.html stays
untagged).
search.html (all overrides #search-scoped, since pagefind-ui.css loads in
<body> after the head CSS):
- compact input/magnifier/clear-button fitted to the sidebar; clear
button uses fixed px (not %) because the results drawer is an in-flow
child of the form, which stretches the form to results height
- hide the empty .result-thumb placeholder (no images in the index) that
was pushing result text ~90px right
- restyle matched-term <mark> from UA yellow to subdued slate
- keyboard navigation (Pagefind 1.5.2 has none; stock Enter is a silent
no-op): capture-phase keydown implements ArrowUp/Down highlighting with
wraparound across top-level hits AND their nested sub-results (each sub
highlights its own .result-nested row), Enter opens the highlighted
result (or the top result), and a fingerprint-aware MutationObserver
keeps the highlight across Pagefind's async re-renders without
resetting it on every DOM patch
108 lines
2.8 KiB
HTML
108 lines
2.8 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="{{ default .Site.Language.Lang .Site.LanguageCode }}" dir="{{ default "ltr" .Site.Language.LanguageDirection }}">
|
|
<head>
|
|
{{ partial "docs/html-head" . }}
|
|
{{ partial "docs/inject/head" . }}
|
|
</head>
|
|
<body dir="{{ default "ltr" .Site.Language.LanguageDirection }}" class="book-kind-{{ .Kind }} book-type-{{ .Type }}{{ with .Layout }} book-layout-{{ . }}{{ end }}">
|
|
<input type="checkbox" class="hidden toggle" id="menu-control" />
|
|
<input type="checkbox" class="hidden toggle" id="toc-control" />
|
|
<main class="container flex">
|
|
{{ template "menu-container" . }} <!-- Left menu -->
|
|
|
|
<div class="book-page">
|
|
<header class="book-header hidden">
|
|
{{ template "header" . }} <!-- Mobile layout header -->
|
|
</header>
|
|
|
|
{{ partial "docs/inject/content-before" . }}
|
|
{{ template "main" . }} <!-- Page Content -->
|
|
{{ partial "docs/inject/content-after" . }}
|
|
|
|
<footer class="book-footer">
|
|
{{ template "footer" . }} <!-- Footer under page content -->
|
|
{{ template "comments" . }} <!-- Comments block -->
|
|
{{ partial "docs/inject/footer" . }}
|
|
{{ template "copyright" . }} <!-- Copyright block -->
|
|
{{ template "clipboard" . }}
|
|
</footer>
|
|
|
|
<label for="menu-control" class="hidden book-menu-overlay"></label>
|
|
</div>
|
|
|
|
{{ template "toc-container" . }} <!-- Table of Contents -->
|
|
</main>
|
|
|
|
{{ partial "docs/inject/body" . }}
|
|
</body>
|
|
</html>
|
|
|
|
{{ define "menu-container" }}
|
|
<aside class="book-menu">
|
|
<div class="book-menu-content">
|
|
{{ template "menu" . }}
|
|
</div>
|
|
</aside>
|
|
{{ end }}
|
|
|
|
{{ define "menu" }}
|
|
{{ partial "docs/menu" . }}
|
|
{{ end }}
|
|
|
|
{{ define "header" }}
|
|
{{ partial "docs/header" . }}
|
|
|
|
{{ if partial "docs/toc-show" . }}
|
|
<aside class="hidden">
|
|
{{ template "toc" . }}
|
|
</aside>
|
|
{{ end }}
|
|
{{ end }}
|
|
|
|
{{ define "footer" }}
|
|
{{ partial "docs/footer" . }}
|
|
{{ end }}
|
|
|
|
{{ define "clipboard" }}
|
|
<!-- Clipboard -->
|
|
{{ with resources.Get "clipboard.js" | resources.Minify }}
|
|
<script>{{ .Content | safeJS }}</script>
|
|
{{ end }}
|
|
{{ end }}
|
|
|
|
{{ define "copyright" }}
|
|
{{ if .Site.Copyright }}
|
|
<div class="book-copyright flex justify-center">
|
|
{{ partial "docs/copyright" . }}
|
|
</div>
|
|
{{ end }}
|
|
{{ end }}
|
|
|
|
{{ define "comments" }}
|
|
{{ if and .Content (default true (default .Site.Params.BookComments .Params.BookComments)) }}
|
|
<div class="book-comments">
|
|
{{- partial "docs/comments" . -}}
|
|
</div>
|
|
{{ end }}
|
|
{{ end }}
|
|
|
|
{{ define "main" }}
|
|
<article class="markdown book-article" data-pagefind-body>
|
|
{{- .Content -}}
|
|
</article>
|
|
{{ end }}
|
|
|
|
{{ define "toc-container" }}
|
|
{{ if partial "docs/toc-show" . }}
|
|
<aside class="book-toc">
|
|
<div class="book-toc-content">
|
|
{{ template "toc" . }}
|
|
</div>
|
|
</aside>
|
|
{{ end }}
|
|
{{ end }}
|
|
|
|
{{ define "toc" }}
|
|
{{ partial "docs/toc" . }}
|
|
{{ end }}
|