You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using Nuxt 2 with Nuxt Bridge and with the useMeta composable enabled, the metadata added via useMeta doesn't seem to be added server-side. This can be observed using the linked reproduction repo (separate window) and then viewing the page source. You'll see that the added title and style tags are not present in the head. Obviously this is not good for SEO, amongst other things.
I'm not knowledgeable enough to propose the above "fix" as a globally appropriate solution but I'm sure it could lead someone down the path to some kind of remedy for this behaviour.
This issue also occurs with Nuxt 3 projects; if you create a pages directory, useMeta is first applied, then removed, and then reapplied.
When having a Nuxt 3 app with no pages/ folder, just app.vue, useMeta is applied before page render.
With the exact same configuration, but the addition of pages, any htmlAttrs in useMeta are applied after page render - a big problem as I'm using it to control the theme of my web app.
Environment
Nuxt CLI v3.0.0-27366343.1d741cb
RootDir: /sandbox
Nuxt project info:
Linux
v14.18.1
2.16.0-27358576.777a4b7f
[email protected]
Webpack
head
,components
,modules
,css
,plugins
,bridge
,buildModules
-
@nuxt/[email protected]
Reproduction
https://codesandbox.io/s/nuxt-2-bridge-usemeta-render-issue-4ibyf
Describe the bug
When using Nuxt 2 with Nuxt Bridge and with the
useMeta
composable enabled, the metadata added via useMeta doesn't seem to be added server-side. This can be observed using the linked reproduction repo (separate window) and then viewing the page source. You'll see that the addedtitle
andstyle
tags are not present in thehead
. Obviously this is not good for SEO, amongst other things.Referring to a now closed PR that seemed to address this issue, I was able to craft a fix — https://codesandbox.io/s/fix-nuxt-2-bridge-usemeta-render-issue-txxnp (separate window). Loading that page and then viewing the source reveals the added meta info in the head, as expected.
I'm not knowledgeable enough to propose the above "fix" as a globally appropriate solution but I'm sure it could lead someone down the path to some kind of remedy for this behaviour.
Additional context
Potentially relevant related issues:
<style>
tags if we're able to dedupe vueuse/head#45Potentially relevant related PR:
Logs
No response
The text was updated successfully, but these errors were encountered: