From 33cb84713fc6cbbd7925c9d51c61e94d3e3cff77 Mon Sep 17 00:00:00 2001 From: Mirek Kratochvil Date: Sat, 17 Jun 2023 20:55:26 +0200 Subject: add tags to the search metadata --- make-search-index.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'make-search-index.js') diff --git a/make-search-index.js b/make-search-index.js index bb92b68..0690dae 100644 --- a/make-search-index.js +++ b/make-search-index.js @@ -3,8 +3,8 @@ * make-search-index.js * * This converts a "search data" file produced by the haskell site builder into - * a lunr.js index and saves it in JSON. Metadata for search (currently titles) - * are stored separately in an extra file. + * a lunr.js index and saves it in JSON. Metadata for rendering search output + * (currently titles and tags) are stored separately in an extra file. * * Installing dependencies: * yarnpkg add lunr @@ -35,5 +35,5 @@ var idx = lunr(function () { fs.writeFileSync(process.argv[3], JSON.stringify(idx), {encoding: 'utf8'}) fs.writeFileSync(process.argv[4], JSON.stringify( - Object.fromEntries(documents.map(x => [x.link, x.title])) + Object.fromEntries(documents.map(x => [x.link, {"title": x.title, "tags": x.tags}])) ), {encoding: 'utf8'}) -- cgit v1.2.3