react-share icon indicating copy to clipboard operation
react-share copied to clipboard

og:image and title

Open mirik999 opened this issue 6 years ago • 14 comments

Hi people, how to correct set sharing ? i attach 3 screenshot , maybe i did mistake. screenshot_4 screenshot_2 screenshot_3

mirik999 avatar Apr 12 '18 09:04 mirik999

I'm not even sure that using the open graph meta tags is within the scope of this project, but it would be an excellent feature to add. If people have taken the time to setup the correct meta tags, the package should be able to use them in the popup window.

brybrophy avatar Apr 12 '18 21:04 brybrophy

But, how can i share dynamic articles ? any example ?

mirik999 avatar Apr 15 '18 08:04 mirik999

@mirik999 I had the same issue and finally managed to solve it. Can you send me how your Social Media component looks like? In my case this was wrong url pointing to the website general but not /blog. Your meta helmet looks fine.

asiajacko avatar May 08 '18 14:05 asiajacko

@asiajacko Social Media component ? you mean js file ?

mirik999 avatar May 10 '18 17:05 mirik999

@mirik999 I also managed to solve this issue. My problem was similar to @asiajacko's.

FB was using my canonical url tag to fetch the html to scrape. In development, my canonical url was pointing to my production instance, so FB would go look at my production html which didn't have the meta tags yet. Once I pushed the helmet code to production, FB was able to scrape and render everything correctly.

brybrophy avatar May 10 '18 18:05 brybrophy

@mirik999 yes! js where u have your social media :) @brybrophy exactly. The only way how to test it is: https://developers.facebook.com/tools/debug/sharing/ (and production url) and https://cards-dev.twitter.com/validator for twitter. Using fb debugger you can see exactly what data fb can render, what is missing etc.

asiajacko avatar May 11 '18 10:05 asiajacko

@asiajacko https://jsfiddle.net/Mirik999/mhxgkr6v/1/ , it is just react component where setted meta tags with url and thumbnail and with other settings. and this component where social media button setted https://jsfiddle.net/Mirik999/ae7mq0gp/

mirik999 avatar May 18 '18 08:05 mirik999

@mirik999 did u tried : https://developers.facebook.com/tools/debug/sharing/ (and production url) and u can see exactly what our scraper sees for your URL, where are mistakes and also you can debug there -- | --

asiajacko avatar Jun 06 '18 13:06 asiajacko

It seems like you need server side rendering to make crawlers(fb, tw, etc) see your open graph tags. Dynamically adding on client side does not work. Crawlers can see only static html.

SlavikMelnyk avatar Jan 09 '19 11:01 SlavikMelnyk

@SlavikMelnyk That is correct. If you don't want to setup SSR though, you can use a service like prerender.io. This service will cache the html output of your rendered app, and serve the cached version to crawlers and social sharing. The cache updates every 24 hours. It's a great, lightweight solution, and is free up to 250 cached pages.

brybrophy avatar Jan 09 '19 17:01 brybrophy

free up to 250 cached pages -> can u explain in more detail?

mirik999 avatar Jan 11 '19 18:01 mirik999

prerender.io is a service the does premiering for you. You can use it for free until you have more than 250 pages cached, then you have to start paying.

For example, if you have and app that has 10 pages, and and app that has 40 pages, you’ll have 50 pages being cached by prerender.io. These cached pages will be served when your app is being crawled by google, or when a link is shared on social media or texted.

You don’t need to set up SSR in your app. pretender.io will just render the html output of your app, and keep that around for crawlers. Regular users will be served your actual app. The cached pages are updated every 24 hours.

brybrophy avatar Jan 11 '19 19:01 brybrophy

So I suppose approach is not working?

MatteoGioioso avatar Apr 08 '19 03:04 MatteoGioioso

Does react-share and react-helmet works together for facebook sharing with image thumbnail or not for client rendered web applications ?

DeepakKapiswe avatar Jan 23 '22 03:01 DeepakKapiswe