Skip to content

Commit 68b6089

Browse files
cscheidcwickham
authored andcommitted
Add weight attribute to promote Guide in algolia search (#1541)
* new custom attribute for algolia search * Use test index temporarily * Back to `prod` index --------- Co-authored-by: Charlotte Wickham <[email protected]> (cherry picked from commit 9dd0c5f)
1 parent fc4db01 commit 68b6089

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

_quarto.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
project:
22
type: website
33
output-dir: _site
4+
post-render:
5+
- tools/algolia-add-custom-attribute.ts
46
resources:
57
- "/docs/download/_download.json"
68
- "/docs/download/_prerelease.json"
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
const j = JSON.parse(Deno.readTextFileSync("_site/search.json"));
2+
j.forEach((entry) => {
3+
const crumb = entry.crumbs || [];
4+
entry.weight = crumb[0] === "Guide" ? 1 : 0;
5+
})
6+
Deno.writeTextFileSync("_site/search.json", JSON.stringify(j, null, 2));
7+

0 commit comments

Comments
 (0)