Thank you for this man. I was struggling a lot with this. I upgraded it a bit since I'm using the category pages too.
exports.onCreatePage=({page,actions})=>{const{createPage,deletePage}=actions;const{locale}=page.context;const{language}=page.context.intl;if(page.context.type==='blog'||page.context.type==='category'){deletePage(page)/**
* Now it will only create pages under
* each locale of the correct language
* as opposed to ALL languages for each.
*/if(locale===language){createPage({...page,context:{...page.context,locale:page.context.intl.language,},});}}};
I had to add locale and type to post and category context
Thank you for this man. I was struggling a lot with this. I upgraded it a bit since I'm using the category pages too.
I had to add locale and type to post and category context
and category respectively