Best practice for indexing and filtering different contents #699
Replies: 1 comment
-
Hi @codejanovic 👋 For this use-case I would usually just generate a single Pagefind instance with filtering to demarcate each specific search. Searching as one combined index has better (network) performance than the merged-index style, so when it's possible to do it's always preferred. The NodeJS API can be used for it all, both ingesting current content and merging it with the standard directory-crawl behavior.
Oop — if true that's definitely a bug 🤔 I'll add an integration test for the node api / ui crossover and see if it smokes anything out. |
Beta Was this translation helpful? Give feedback.
-
Hi everyone,
after trying out Pagefind with AstroJS and reading throught the documentation (especially Node-API, Filtering and Multisite), I am struggling on how to index & filter different contents independently and bundle them all together on one site.
Heres what I want to index:
/company
,/aboutme
,/gdpr
and so on from generated *.html filesNow I would like to implement different searches on my site, searching only for the relevant indexes like:
/products/
site should offer a search that only uses the product index/blog/
site should offer a search that only uses the blogindex/articles/
site should offer a search that only uses the articles indexWhat I've tried so far:
data-pagefind-body
attributes, generatingdist/pagefind
(optional)dist/pagefind-product
folder (required)dist/pagefind-article
folder (required)dist/pagefind-blog
folder (required)Then for example on the
/product
page, I am initializing the PagefindUI by defining mergeFilters:But I get the following error:
What also confused me is that using the Node-API only will generate empty files for
pagefind-ui.css
andpagefind-ui.js
. It seems only the pagefind CLI will generate them properly.Would love to hear your feedback or even sample code/projects of people that may already implemented such a usecase.
Cheers,
Aleks
Beta Was this translation helpful? Give feedback.
All reactions