Closed tiwka19 closed 10 months ago
I request posts via the API and create them via the getStaticPath function
const { slug } = Astro.params; export async function getStaticPaths() { const directus = await getDirectusClient(); const data = await directus.query(` query { partners (filter: {status: { _eq: "published"}}) { slug } } `); return data.partners.map((item) => ({ params: { slug: item.slug.replace("en" + "/", "") }, })); }
but I have a different number of posts for each language.
then I create a second query and pull the full post information for the current slug
const data = await directus.query(` query { partners (filter: {status: { _eq: "published"} slug: { _eq: "${slug}" } translations: { title: {_nempty: true} content: {_nempty: true} } }) { name link promocode logo { filename_disk } css_background thumbnail { filename_disk } translations(filter: { languages_code: { code: { _eq: "${locale}" } } }) { title description content offer } } } `);
but when I build, posts appear in the other language that shouldn't be there, and the build breaks because I get undefined and try to output it to markup
I request posts via the API and create them via the getStaticPath function
but I have a different number of posts for each language.
then I create a second query and pull the full post information for the current slug
but when I build, posts appear in the other language that shouldn't be there, and the build breaks because I get undefined and try to output it to markup