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

meta tag for facebook is not working. #668

Open
alexaung opened this issue Feb 6, 2022 · 6 comments
Open

meta tag for facebook is not working. #668

alexaung opened this issue Feb 6, 2022 · 6 comments

Comments

@alexaung
Copy link

alexaung commented Feb 6, 2022

Do you want to request a feature or report a bug?

What is the current behavior?
Meta tags for facebook is not working but title show on chrome's title
**If the current behavior is a bug,
https://github.com/alexaung/my_chordsheep

What is the expected behavior?
When share the link, facebook should grab the title, description

**Which versions of React and react-helmet, and which browser / OS are affected by this issue?
"react": "^17.0.2",
"react-helmet": "^6.1.0"
Chrome
macOS Monterey V12,1

Did this work in previous versions of React and/or react-helmet?**
This is first time added

@rmacuna
Copy link

rmacuna commented Feb 8, 2022

I have the same problem, meta tags for faecbook and twitter is not working. I have already tried by sorting the meta tags to place it at the top of the head but with no success. It seems that onPreRenderHTML is not even getting the meta tags that I dynamically set in my screens.

@KuschL
Copy link

KuschL commented Feb 9, 2022

The crawlers of Facebook and Twitter cannot interpret Javascript. Therefore, the meta tags must be rendered by the server.

To achieve this you can look at NextJS for example. Then you don't need this library anymore, because NextJS has a built-in one: https://nextjs.org/docs/api-reference/next/head

@alexaung
Copy link
Author

@KuschL My app is created by vitejs with reactjs and hosted on firebase hosting. Do you mean I need to create another project with NextJs for SSR? I have no experience in NextJS.

@KuschL
Copy link

KuschL commented Feb 11, 2022

Unfortunately, I have no experience with vitejs. However, the documentation may help you: https://vitejs.dev/guide/ssr.html

@alexaung
Copy link
Author

Oh. thanks for the documentation. I did not see it. I will look into it.

@alex-bukach
Copy link

Please check this solution.

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

No branches or pull requests

4 participants