Files
libertytoolsio/themes/hugo-book/layouts/_partials/docs/html-head.html
T
noether 0d24df31ad search: replace Fuse.js with Pagefind (Default UI) + full UI polish
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
2026-10-11 08:59:18 -06:00

56 lines
2.3 KiB
HTML

{{ "<!--" | 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: handled by Pagefind (see _partials/docs/search.html, injected into the
sidebar via menu.html). The legacy Fuse.js search was removed to avoid double-loading. -->
<!-- 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 -}}