Skip to content
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

useSeoMeta not working together with ClientOnly #28229

Closed
AloisSeckar opened this issue Jul 19, 2024 · 3 comments
Closed

useSeoMeta not working together with ClientOnly #28229

AloisSeckar opened this issue Jul 19, 2024 · 3 comments

Comments

@AloisSeckar
Copy link
Sponsor Contributor

AloisSeckar commented Jul 19, 2024

Environment

Reproduction

I am observing the behaviour in my project https://github.com/AloisSeckar/WBSC-Scoring deployed at Netlify https://wbsc-scoring-dev.netlify.app/

Describe the bug

I am using useSeoMeta wrapped in a composable to include meta tags to my project. It works fine for fully SSR pages, but when I tried to have part of my page <ClientOnly> because of hydration mismatch issues related to i18n module, meta tags were not visible for Facebook crawler at all.

This commit commenting out the <ClientOnly> component made it working again.

Maybe it is intended behaviour, but if so, then I don't understand why? A part of the site is being rendered on server, so it should be enriched with meta tags via useSeoMeta, or?

Additional context

No response

Logs

No response

@danielroe
Copy link
Member

danielroe commented Jul 19, 2024

It's no surprise that if you don't render a component on the server, that it won't run the setup function or add the meta tags to the rendered HTML, which means that the crawler won't see them.

Instead you can move the code outside of the client only portion, such as inside app.vue

@danielroe danielroe closed this as not planned Won't fix, can't repro, duplicate, stale Jul 19, 2024
@AloisSeckar
Copy link
Sponsor Contributor Author

Oh, yea. Now I am getting it. I am adding meta tags on page component level, so it cannot work when I wrap <NuxtPage> into <ClientOnly>. That was the missing piece I cannot figure out...

Sorry for opening unnecessary issue 😞

@danielroe
Copy link
Member

No worries at all!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants