#Translate path segments of content collections

3 messages · Page 1 of 1 (latest)

tiny rose
tiny rose
#

Bonus question: How to set a default language for this scenario? like when [lang] is not given, that it's en and still render [...slug].astro? It feels like I will end up writing my own router in a file pages/[...path].astro...

cold hinge
#

to translate blog, you'd have to make this another dynamic param e.g. [blog] where getstaticpaths returns your translation of blog

if you replace [lang] with [...lang] you can include an entry with the param lang: undefined, which will handle the top-level case (then anywhere you fetch content, specify your default lang e.g. en).