Open DigneZzZ opened 1 week ago
I managed to make it work using this guide.
You'll need to move src/pages/blog/
to a new folder: src/pages/[lang]/blog/
. And then make sure to update getStaticPaths
to include the param lang
in both src/pages/[lang]/blog/[...page].astro
and src/pages/[lang]/blog/[slug].astro
Example: src/pages/[lang]/blog/[...page].astro
export const getStaticPaths = (async ({ paginate }) => {
const allPosts = await getAllPosts(true);
const allPostsByDate = sortMDByDate(allPosts);
const allPostsByPinned = sortMDByPinned(allPostsByDate);
const tags = getUniqueTags(allPosts);
const supportedLangs = [ "en", "es"];
return supportedLangs.flatMap((lang: string) => {
return paginate(allPostsByPinned, {
params: { lang },
props: { tags },
pageSize: 10,
});
});
}) satisfies GetStaticPaths;
After that, you'll have update all links to go to the correct path.
The new path should look like this: /[lang]/blog/post-slug-name
.
Once I have more time, I'll work on making this a supported feature.
Hi, Amy! Thank you for the response! Yes, I also found this instruction. But it didn't help me much :( I spent about three days trying to do the localization, but with each build, I was getting a bunch of errors. That's why I was only able to make just the title page :(
I would be very grateful if you have time and could create an original version of the theme that supports this multilingual capability! Actually, I would really like to have an integrated search as well, but I think that can be the next step.
Hi!, Thanks for this cool minimalistic theme! I have a question: How can I make this theme multilingual? I managed to get the English version working for the homepage, but I'm struggling with making it work for blog and project pages. Could you please help me set up multilingual support for those sections? Ideally, I'd like to implement a language switcher for the entire site.