nuxt-ghost-blog
nuxt-ghost-blog copied to clipboard
Internationalization
Any direction on implementing internationalization? I've got nuxt-i18n
working fine with all other text on the site but unsure how to approach getting it to work with posts.
The plugin has created the routes for the posts, all prefixed with /es/<slug>
, I just need to get the correct language posts to show when the language is switched between English and Spanish.
Ghost appears to track language by a private tag which is prefixed with a #
, like #es
. So maybe filtering PostIndex by tag on the front end?
You're on the right track with the filtering! I did the same thing and with some workarounds I managed to get it working.
Except for the #lang (#es/#en) tags for every post I had to create a #url (#boss/#patron) tag and cross-link it to the opposite post, so it is known which URL to redirect to when language is switched. I can imagine there are different ways to do it but I wanted to keep things as changeable through the CMS as possible.
Regarding the filtration function here's a link to what I use.
If you want to maintain the translations as flexible as possible you can use the secondary navigation as the translation.
Good luck!