useMeta doesn't seem to render server-side
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 285
- Forks
- 33
- Avg merge
- 22h 38m
- Merged PRs (30d)
- 3
Description
Environment
Nuxt CLI v3.0.0-27366343.1d741cb
RootDir: /sandbox
Nuxt project info:
- Operating System:
Linux - Node Version:
v14.18.1 - Nuxt Version:
2.16.0-27358576.777a4b7f - Package Manager:
yarn@1.22.17 - Bundler:
Webpack - User Config:
head,components,modules,css,plugins,bridge,buildModules - Runtime Modules:
- - Build Modules:
@nuxt/bridge@3.0.0-27366343.1d741cb
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 added title and style tags are not present in the head. 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:
- https://github.com/nuxt/nuxt.js/issues/12814
- https://github.com/vueuse/head/issues/44
- https://github.com/nuxt/nuxt.js/issues/12980
- https://github.com/vueuse/head/issues/45
Potentially relevant related PR:
Logs
No response
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the linked CodeSandbox reproduction and compare its page source with the linked fixed reproduction. Trace how the useMeta composable is connected to Nuxt Bridge's server-side head rendering, using related PR 2419 and the linked issues for context. Done means the title and style metadata appear in the server-rendered head.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- nuxt, typescript
- Domain
- frontend, web-dev
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100