I've been working on adding the i18n feature to my Astro project following the guidance provided in the official documentation here: https://docs.astro.build/en/recipes/i18n/.
I've successfully implemented translation for my site, but I'm facing challenges when it comes to using collections for translated content. Specifically, my blog posts aren't loading as expected. It is showing all posts from all languages.
In the docs have only instructions for a regular collection without pagination. But in my case I use pagination.
I understand I have to filter the languages in the getStaticPaths method but Im not sure how. Here is what I have:
pages/blog/[page].astro (en)
...
export const getStaticPaths = (async ({ paginate }) => {
const posts = (await getCollection("blog")).sort(
(a, b) => b.data.pubDate.valueOf() - a.data.pubDate.valueOf(),
);
return paginate(posts, { pageSize: LIST_CONTENT_PAGE_SIZE });
}) satisfies GetStaticPaths;
...