-
Notifications
You must be signed in to change notification settings - Fork 475
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Pre-rendering multiple routes with i18n #3080
Comments
Do you have a LanguageSelector component that the crawler can use to detect your other locales and discover them correctly that way? |
I do, but since it’s a dropdown, the links to other locales are not present in the initial HTML. |
Then I'd suggest to include them in the initial HTML and show/hide them using v-show instead of v-if. Perhaps extend your dropdown component with a prop to control how the dropdown items are rendered. |
Describe the feature
Basically, I have some routes that I need to prerender for 7 different locales:
/login
,/login/sign-up
,/login/forgot-password
.First, I tried to pre-render them using route rules:
However, that didn’t work because, as stated in the Nuxt documentation, pages should be linked from other pages:
All my pages are linked, but they are linked using localePath, and I believe that because of this, the pre-renderer does not recognize that they are linked.
I found a workaround by manually adding routes to the Nitro pre-renderer array:
This method successfully prerendered all routes, but only for my default locale. If I want to prerender all locales, I need to manually add each one to that array. With 7 different locales, I would need to add 21 different routes manually, which seems like poor UX.
Additional information
Final checks
The text was updated successfully, but these errors were encountered: