Skip to content

Commit a106ee1

Browse files
committed
run post-render script only on project render
skip incremental and preview
1 parent 4deb131 commit a106ee1

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

tools/algolia-add-custom-attribute.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
// don't run the post-render on incremental render or preview
2+
console.log("Running post-render script for Algolia search index.");
3+
if (!Deno.env.get("QUARTO_PROJECT_RENDER_ALL")) {
4+
console.log(" Skipping custom attribute addition for Algolia search as this is not a full render.");
5+
Deno.exit(0);
6+
}
7+
console.log(" Adding custom attribute for Algolia search.");
8+
// This script adds a custom attribute to the Algolia search index for guides
19
const j = JSON.parse(Deno.readTextFileSync("_site/search.json"));
210
j.forEach((entry) => {
311
const crumb = entry.crumbs || [];

0 commit comments

Comments
 (0)