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
39 lines
1.1 KiB
HTML
39 lines
1.1 KiB
HTML
{{ define "main" }}
|
|
{{ range sort .Paginator.Pages }}
|
|
<article class="book-post markdown" data-pagefind-body>
|
|
<h2>
|
|
<a href="{{ .RelPermalink }}">{{ partial "docs/title" . }}</a>
|
|
</h2>
|
|
<div class="book-post-container flex gap">
|
|
<div>
|
|
{{ partial "docs/post-meta" . }}
|
|
<div class="book-post-content markdown-inner">
|
|
{{- .Summary | truncate 256 -}}
|
|
</div>
|
|
</div>
|
|
{{- $thumbnail := default "thumbnail.*" .Params.BookPostThumbnail -}}
|
|
{{- with or (.Resources.GetMatch $thumbnail) (resources.GetMatch $thumbnail) -}}
|
|
<div class="book-post-thumbnail">
|
|
<img src="{{ .RelPermalink }}" alt="{{ partial "docs/text/i18n" "Thumbnail" }}" />
|
|
</div>
|
|
{{- end -}}
|
|
</div>
|
|
</article>
|
|
{{ end }}
|
|
{{ end }}
|
|
|
|
{{ define "toc-container" }}
|
|
<aside class="book-toc">
|
|
<div class="book-toc-content">
|
|
{{ template "toc" . }}
|
|
</div>
|
|
</aside>
|
|
{{ end }}
|
|
|
|
{{ define "toc" }}
|
|
{{ partial "docs/taxonomy" . }}
|
|
{{ end }}
|
|
|
|
{{ define "footer" }}
|
|
{{ partial "docs/pagination.html" . }}
|
|
{{ end }} |