gatsbyjs / gatsby

The best React-based framework with performance, scalability and security built in.
https://www.gatsbyjs.com
MIT License
55.3k stars 10.31k forks source link

Dynamic meta tags #23512

Closed jojobagings78 closed 4 years ago

jojobagings78 commented 4 years ago

I am currently implementing a page with /asset/:id and routing however when it comes to dynamic meta data it seems to not show anything or even without dynamically changing the title it seems to still not show anything.

`

` Then I call SEO component passing the title which is static at the moment and not based on data from the page. However it seems that static or dynamic does not work when routing. Does anyone have any idea how to get dynamic meta data for pages in gatsby to work and even static while using router ?
LekoArts commented 4 years ago

Thank you for opening this!

You'll need to use react-helmet (https://github.com/nfl/react-helmet) on your client-only page and or use the provided component. Here's a working example:

We're marking this issue as answered and closing it for now but please feel free to comment here if you would like to continue this discussion. We also recommend heading over to our communities if you have questions that are not bug reports or feature requests. We hope we managed to help and thank you for using Gatsby!

jojobagings78 commented 4 years ago

Thank you for opening this!

You'll need to use react-helmet (https://github.com/nfl/react-helmet) on your client-only page and or use the provided component. Here's a working example:

We're marking this issue as answered and closing it for now but please feel free to comment here if you would like to continue this discussion. We also recommend heading over to our communities if you have questions that are not bug reports or feature requests. We hope we managed to help and thank you for using Gatsby!

I took a look at your example and it does not work for sharing eg on social media or skype and etc because it does not read the meta data still. https://tmdb.lekoarts.de/detail/tv/72750

Already using helmet and calling it in the SEO component but does nothing for sharing and etc no title passed while sharing and so on.

jonasbarsten commented 4 years ago

Hi!

I'm having a similar issue as @jojobagings78.

I also checked @LekoArts example with facebooks sharing debugger and it doesn't look happy:

https://developers.facebook.com/tools/debug/?q=https%3A%2F%2Ftmdb.lekoarts.de%2Fdetail%2Ftv%2F72750

@jojobagings78, did you figure this out? Or does anyone else have a solution?

All the best.

lambdahands commented 4 years ago

Hello, I'm having the same issue with Facebook and meta tag rendering through Gatsby. This seems like a use case that isn't easily supported after digging through other threads with related issues (specifically rendering static content with react-helmet). Has anyone found a good solution to this?

Cassianosch commented 4 years ago

Same here

Jaime5Alvarez commented 11 months ago

any solution ? Same problem here. Only works when I execute yarn build again