Date: Thu, 19 Sep 2024 16:59:36 +0200
Subject: [PATCH 8/9] update guide docs
---
docs/src/content/docs/guides/site-search.mdx | 38 ++++++++++++++++++++
1 file changed, 38 insertions(+)
diff --git a/docs/src/content/docs/guides/site-search.mdx b/docs/src/content/docs/guides/site-search.mdx
index 0de34add47..994dcd328a 100644
--- a/docs/src/content/docs/guides/site-search.mdx
+++ b/docs/src/content/docs/guides/site-search.mdx
@@ -42,6 +42,44 @@ This text will be hidden from search.
```
+## Adjust ranking in search results
+
+Pagefind's index ranking can be adjusted using the [`data-pagefind-weight`](https://pagefind.app/docs/weighting/#ranking-content-higher-or-lower) attribute. This can be used to [adjust a whole page](#adjust-whole-page-rank) or [individual sections of a page](#adjust-individual-section-rank).
+
+Learn more about about how the weight value impacts search results in the [Pagefind Weighting content guide](https://pagefind.app/docs/weighting/).
+
+### Adjust whole page rank
+
+To adjust where a page is listed in the Pagefind search results, add the [`pagefind.weight`](/reference/frontmatter/#pagefind) property to the page's frontmatter:
+
+```md title="src/content/docs/important-doc.md" ins={3,4}
+---
+title: Content to hide from search
+pagefind:
+ weight: 2
+---
+```
+
+### Adjust individual section rank
+
+Pagefind will use the [`data-pagefind-weight`](https://pagefind.app/docs/weighting/#ranking-content-higher-or-lower) attribute to adjust the ranking of search results.
+
+In this example, the
+
+```md title="src/content/docs/custom-weighted-page.md" ins="data-pagefind-weight=\"5.0\""
+---
+title: Custom Weighted Page
+---
+
+This text will be ranked normally.
+
+
+
+This text will be ranked higher in search results.
+
+
+```
+
## Alternative search providers
### Algolia DocSearch
From 820161be493474171c9902c724fa280e9ca40be7 Mon Sep 17 00:00:00 2001
From: Lorenzo Lewis
Date: Thu, 19 Sep 2024 17:06:55 +0200
Subject: [PATCH 9/9] update references guide
---
.../src/content/docs/reference/frontmatter.md | 19 +++++++++++++++++--
1 file changed, 17 insertions(+), 2 deletions(-)
diff --git a/docs/src/content/docs/reference/frontmatter.md b/docs/src/content/docs/reference/frontmatter.md
index 75b564442b..a39795cf26 100644
--- a/docs/src/content/docs/reference/frontmatter.md
+++ b/docs/src/content/docs/reference/frontmatter.md
@@ -255,10 +255,12 @@ next: false
### `pagefind`
-**type:** `boolean`
+**type:** `boolean | { weight: number; }`
**default:** `true`
-Set whether this page should be included in the [Pagefind](https://pagefind.app/) search index. Set to `false` to exclude a page from search results:
+Set the weighting of a page in the [Pagefind](https://pagefind.app/) search index or whether the page should be included.
+
+Set to `false` to exclude a page from search results:
```md
---
@@ -268,6 +270,19 @@ pagefind: false
---
```
+Set to `pagefind.weight` with a number between 0 and 10 (inclusive) to adjust the ranking a page in search results:
+
+```md
+---
+# src/content/docs/example.md
+# Adjust the ranking of a page
+pagefind:
+ weight: 4.0
+---
+```
+
+Learn more about about how the weight value impacts search results in the [Pagefind Weighting content guide](https://pagefind.app/docs/weighting/).
+
### `draft`
**type:** `boolean`