summaryrefslogtreecommitdiff
path: root/layouts
diff options
context:
space:
mode:
authorEltrac <hi@guhub.cn>2025-09-10 19:38:18 +0800
committerEltrac <hi@guhub.cn>2025-09-10 19:38:18 +0800
commitab09dc19b06d71068d6eca04729b0ecca363d4ad (patch)
tree8198b196852c1f26f5f7d1edf2cffe0a0dc97071 /layouts
parenta9df6135afc96607fbb8d576c944cedf91e36948 (diff)
perf: load pagefind js and css only when needed
Former-commit-id: ab0f89677c5daced755b64b66f3c79cd61d65220
Diffstat (limited to 'layouts')
-rw-r--r--layouts/_partials/head/css.html5
-rw-r--r--layouts/taxonomy.html1
2 files changed, 6 insertions, 0 deletions
diff --git a/layouts/_partials/head/css.html b/layouts/_partials/head/css.html
index cbc0f4ba..250ef4a3 100644
--- a/layouts/_partials/head/css.html
+++ b/layouts/_partials/head/css.html
@@ -12,6 +12,11 @@
<style>{{ .Content | safeCSS }}</style>
{{ end }}
+<!-- Pagefind -->
+{{ if eq .Kind "taxonomy" }}
+<link rel="stylesheet" href="/pagefind/pagefind-ui.css">
+{{ end }}
+
<!-- Extra -->
{{ range .Site.Params.extraCSSFiles -}}
<link
diff --git a/layouts/taxonomy.html b/layouts/taxonomy.html
index 150879f5..02624d59 100644
--- a/layouts/taxonomy.html
+++ b/layouts/taxonomy.html
@@ -12,6 +12,7 @@
{{ partial "taxonomy/all-categories.html" . }}
</article>
+<script src="/pagefind/pagefind-ui.js"></script>
<script>
window.addEventListener('DOMContentLoaded', () => {
new PagefindUI({ element: "#pagefind", showSubResults: true });