Skip to content

Commit

Permalink
Add weight attribute to promote Guide in algolia search (#1541)
Browse files Browse the repository at this point in the history
* 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)
  • Loading branch information
cscheid authored and github-actions[bot] committed Jan 17, 2025
1 parent fc4db01 commit 68b6089
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
2 changes: 2 additions & 0 deletions _quarto.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
project:
type: website
output-dir: _site
post-render:
- tools/algolia-add-custom-attribute.ts
resources:
- "/docs/download/_download.json"
- "/docs/download/_prerelease.json"
Expand Down
7 changes: 7 additions & 0 deletions tools/algolia-add-custom-attribute.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
const j = JSON.parse(Deno.readTextFileSync("_site/search.json"));
j.forEach((entry) => {
const crumb = entry.crumbs || [];
entry.weight = crumb[0] === "Guide" ? 1 : 0;
})
Deno.writeTextFileSync("_site/search.json", JSON.stringify(j, null, 2));

0 comments on commit 68b6089

Please sign in to comment.