-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use in Astro SSR sites? #54
Comments
Thanks @shah. The extension doesn't work with SSR at the moment because it runs pagefind CLI index on the Astro static HTML output. Just curious why you choose SSR over SSG if your content is in static Markdown files? |
Good question @shishkin - we have about 50% of our site dynamic and the other 50% is Markdown -- we started in SSG with some islands support and then tried hybrid, but our use case is easier to implement with full SSR. If you have any guidance for how to use Pagefind with SSR (knowing that indexing is required) we'd love those tips/tricks. |
You might want to try and use pagefind Node.JS API to index content dynamically. I didn't use it myself and am not sure what obstacles it may present. If you get it to work, it would be a great addition to this extension. |
Agreed @shishkin that's that API we're planning to use if there was not any other Astro-specific solution :-). Thanks! |
@shishkin @shah was able to get the pagefind Node.JS api working. Rough example
|
@ColeTownsend would you mind sharing a little context for how to use this snippet of code? |
@paulrudy The example that @ColeTownsend provided is a reimplementation of this integration using Pagefind's Node API instead of CLI invocations. FYI, since 1.6.0 this integration has also switched to using Pagefind's Node API. For the context of this issue, feel free to use this integration's source to implement your own SSR pagefind integration. |
@paulrudy ah sorry, this would be defined as a function (i was lazy and did it within my astro.config.mjs file) and then the function passed to your astro config. //... rest of config file
integrations: [
mdx(),
react(),
metaTags(),
tailwind({
applyBaseStyles: false,
}),
pagefindIntegration(),
], |
@shishkin @ColeTownsend thank you both very much. Since astro-pagefind uses the Pagefind's Node API, I went with just using that. Works great! (Switched from Astro server mode to hybrid so I could make use of this. Fortunately, I think I had only been using server mode because way back when, static pages in Astro didn't generate an actual 404 Response when serving a 404 page.) |
Great integration @shishkin! We are using Astro 3.0 in SSR mode with many Markdown pages. Does your
astro-pagefind
integration work with SSR pages?The text was updated successfully, but these errors were encountered: