#pagefind with i18n routing and redirects?

1 messages · Page 1 of 1 (latest)

thorny saddle
#

Hey. I am looking for resource on how to use astro i18n with pagefind?

For different languages instead of static pages I have some insane .index files with redirects and pagefind indexes that completely wrong?

I know it looks a bit different in astro starlight so they must kno the trick?

dense canopyBOT
#

Hi @thorny saddle. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:

#

I understand you're having issues with Pagefind and Astro's i18n routing, particularly with redirects affecting your search indexing.

The knowledge sources provided don't contain specific information about integrating Pagefind with Astro's i18n routing. While Astro has robust internationalization features, including various routing strategies like prefixDefaultLocale, redirectToDefaultLocale, and fallback options, there's no direct mention of how these interact with Pagefind specifically.

You mentioned Starlight, which is Astro's documentation theme that does include i18n support. Starlight's approach to i18n involves creating language-specific directories for content, but the knowledge sources don't detail how it handles Pagefind integration specifically.

For your issue with redirects affecting Pagefind indexing, you might want to consider:

  1. Using Astro's routing configuration options to control how your i18n URLs are structured
  2. Exploring the manual routing option (added in Astro 4.6.0) which gives you complete control over i18n routing logic
// Example of manual routing configuration
export default defineConfig({
  i18n: {
    locales: ["es", "en", "fr"],
    defaultLocale: "en",
    routing: "manual"
  }
})

I'd recommend checking the official Pagefind documentation for specific guidance on handling i18n sites, or reaching out to the Astro community forums where others might have solved this specific integration challenge.

Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: