grip
how to add ld+json scripts in nuxt3
in nuxt 2 i had these entries in my head in nuxt config
script: [
{
type: 'application/ld+json',
json: {
'@context': 'https://schema.org',
'@type': 'Organization',
url: 'https://example.com',
logo: 'https://example.com/static/logo-square.png'
}
},
{
type: 'application/ld+json',
json: {
'@context': 'https://schema.org',
'@type': 'WebSite',
url: 'https://example.com',
logo: 'https://example.com/static/logo-square.png',
potentialAction: {
'@type': 'SearchAction',
target: {
'@type': 'EntryPoint',
urlTemplate:
'https://example.com/cars/?q={search_term_string}&from-search-engine=1'
},
'query-input': 'required name=search_term_string'
}
}
}
]
how can i add them in nuxt3?
14 replies
Migrating nuxt2 to nuxt3 vuex store
Hi im migrating an app from nuxt2 to nuxt3. It currently uses vuex and im trying to move to nuxt3 without moving to pinia yet. The problem is that in nuxt2, the store uses a lot of
this.$injectedProperty
in its actions. How can i use the nuxtApp injected properties in vuex in nuxt 3?34 replies
Dynamically add routes in runtime based on pinia store value
I want to dynamically add some protected admin routes on my app only for the admin user type. the admin user type is evaluated server side in a plugin. can i use router.addRoutes there?
for my routes i dont use the file system routing but the router.options.ts method instead
15 replies
Third-party script hydration mismatch
Hey, I have a third-party script for my CMP which modifies part of the
<body>
to add the elements required to show the cookie banner.
The script is loaded with async
and defer
.
When these elements are added, I get a hydration error.
Using the app:mounted hook or some fixed timeout to show the banner is a solution but then i get a hit in LCP. Any recommendations on how to approach this?
thanks!5 replies