mirror of
https://github.com/docker/docs.git
synced 2026-03-27 06:18:55 +07:00
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
This commit is contained in:
@@ -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 }}
|
||||
</div>
|
||||
|
||||
@@ -1,19 +1,13 @@
|
||||
<nav
|
||||
id="breadcrumbs"
|
||||
{{- $breadcrumbTitles := slice }}
|
||||
data-pagefind-ignore
|
||||
class="breadcrumbs mb-4 flex min-w-0 items-center gap-2 text-gray-400 dark:text-gray-300"
|
||||
>
|
||||
{{ range .Ancestors.Reverse }}
|
||||
{{ $breadcrumbTitles = $breadcrumbTitles | append .LinkTitle }}
|
||||
<a href="{{ .Permalink }}" class="link truncate"
|
||||
>{{ markdownify .LinkTitle }}</a
|
||||
>
|
||||
<span>/</span>
|
||||
{{- end }}
|
||||
<span
|
||||
data-pagefind-meta="breadcrumbs:{{ collections.Delimit $breadcrumbTitles " / " }}"
|
||||
class="truncate"
|
||||
>{{ markdownify .LinkTitle }}</span
|
||||
>
|
||||
<span class="truncate">{{ markdownify .LinkTitle }}</span>
|
||||
</nav>
|
||||
|
||||
10
layouts/partials/pagefind-meta.html
Normal file
10
layouts/partials/pagefind-meta.html
Normal file
@@ -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 }}<meta data-pagefind-meta="description:{{ . }}">{{ end }}
|
||||
{{- with $keywords }}<meta data-pagefind-meta="keywords:{{ delimit . ", " }}">{{ end }}
|
||||
{{- with $breadcrumbs }}<meta data-pagefind-meta="breadcrumbs:{{ delimit . " / " }}">{{ end }}
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user