From 77645c2e8f9af5751ce9f14155fe6558083701c9 Mon Sep 17 00:00:00 2001
From: David Karlsson <35727626+dvdksn@users.noreply.github.com>
Date: Thu, 5 Feb 2026 20:14:49 +0000
Subject: [PATCH] site: add pagefind metadata for improved search ranking
Index description, keywords, and breadcrumbs as Pagefind metadata
to improve search result relevance. Configure ranking weights to
prioritize title matches and reduce term frequency bias.
- Add pagefind-meta.html partial for centralized metadata
- Move breadcrumb metadata from breadcrumbs.html to new partial
- Configure metaWeights: title (10x), keywords (6x), description (4x)
Assisted-By: cagent
---
layouts/_default/baseof.html | 1 +
layouts/partials/breadcrumbs.html | 8 +-------
layouts/partials/pagefind-meta.html | 10 ++++++++++
layouts/partials/search-bar.html | 7 ++++++-
4 files changed, 18 insertions(+), 8 deletions(-)
create mode 100644 layouts/partials/pagefind-meta.html
diff --git a/layouts/_default/baseof.html b/layouts/_default/baseof.html
index 946147a21e..ebb1e7f5d8 100644
--- a/layouts/_default/baseof.html
+++ b/layouts/_default/baseof.html
@@ -63,6 +63,7 @@
{{ if ne .Params.sitemap false }}data-pagefind-body{{- end }}
class="dark:bg-background-dark w-full min-w-0 bg-white p-8"
>
+ {{ partial "pagefind-meta.html" . }}
{{ block "main" . }}
{{ end }}
diff --git a/layouts/partials/breadcrumbs.html b/layouts/partials/breadcrumbs.html
index fc893af263..7c2ce060db 100644
--- a/layouts/partials/breadcrumbs.html
+++ b/layouts/partials/breadcrumbs.html
@@ -1,19 +1,13 @@
diff --git a/layouts/partials/pagefind-meta.html b/layouts/partials/pagefind-meta.html
new file mode 100644
index 0000000000..f08a9346e8
--- /dev/null
+++ b/layouts/partials/pagefind-meta.html
@@ -0,0 +1,10 @@
+{{/* Pagefind metadata - must be inside data-pagefind-body */}}
+{{- $description := partial "utils/description.html" . -}}
+{{- $keywords := partialCached "utils/keywords.html" . . -}}
+{{- $breadcrumbs := slice -}}
+{{- range .Ancestors.Reverse -}}
+ {{- $breadcrumbs = $breadcrumbs | append .LinkTitle -}}
+{{- end -}}
+{{- with $description }}{{ end }}
+{{- with $keywords }}{{ end }}
+{{- with $breadcrumbs }}{{ end }}
diff --git a/layouts/partials/search-bar.html b/layouts/partials/search-bar.html
index 3192fd8a3b..0d4a6552aa 100644
--- a/layouts/partials/search-bar.html
+++ b/layouts/partials/search-bar.html
@@ -23,7 +23,12 @@
termFrequency: 0.0,
termSimilarity: 2.0,
pageLength: 0.0,
- termSaturation: 1.0
+ termSaturation: 1.0,
+ metaWeights: {
+ title: 10.0,
+ description: 4.0,
+ keywords: 6.0
+ }
}
});