Feature: Dynamic route parameters should not be set using definePageMeta #1730
Replies: 4 comments 4 replies
-
We are just looking at the same issue. A composable would be very cool. |
Beta Was this translation helpful? Give feedback.
-
Trying this indeed does not work: const nuxtI18n = computed(() => articles?.value?.[0]?.languages || {});
definePageMeta({
nuxtI18n,
}); |
Beta Was this translation helpful? Give feedback.
-
I have just released The composable works in a similar way to your proposed solution, please let me know if it works for your or if you run into any issues! |
Beta Was this translation helpful? Give feedback.
-
Hey guys I think I have found a workaround for SSR dynamic slugs. https://gist.github.com/romainavalle/638dcffb657fe49857a00a45aa3ecf48 |
Beta Was this translation helpful? Give feedback.
-
Hi, thanks for the great work with this module.
I stumbled into a problem with i18n module v8 and nuxt3 and I think it might be interesting to change this in the future, as it makes it difficult to use with dynamic content.
Please, correct me if i'm not doing in right.
The Problem
According to the Dynamic route parameters documentation, to set translations for route params we should use
definePageMeta
like so:However, the Nuxt 3 documentation about
definePageMeta
(right here) says that the page meta object cannot reference the component (or values defined on the component).It means that the content inside
definePageMeta({})
is supposed to be hard-coded and cannot be dynamic, making it impossible to set the page route params dynamically (as they often are). The following code won't work:A solution
Instead of using
definePageMeta
, maybe i18n module could give us a composable likesetParamsTranslations
or whatever, that could be used like this:If anyone agrees I can create an issue (feature)
Beta Was this translation helpful? Give feedback.
All reactions