-
Notifications
You must be signed in to change notification settings - Fork 657
Helmet not working with Facebook scraper. #26
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
Comments
When you "ViewSource" on your app, you should see the |
It actually does not contain any at render time. It takes a second for the tags to be injected - I know this, because I see the Tab title flicker from the default to the one set by Helmet after a split second. |
@sampurcell93 This may be an implementation issue. We use Helmet in production and Helmet does successfully pre-render data (view source). In your example, you are calling React.renderToString(<Handler />);
let head = Helmet.rewind();
// head = { title, meta, link } Which you can then send to the server (pseudo-code): res.send(`
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
${head.meta}
${head.link}
<title>${head.title}</title>
</head>
<body>
</body>
</html>
`); |
Hi, i'm also seeing problems with Facebook scraper not picking up the og tags. I have for the moment just hard coded them on my index but my posts use helmet to inject the image and title. Is this an issue with Helmet or React? site in question is here: pauliescanlon.io it's the posts page after you view a portfolio item that's my current problem. |
+1 |
@RuslanYurchenko The issue is not with Helmet. Crawlers can only read what’s in the meta tag that’s hard coded. Using helmet to inject this data at run time doesn’t mean it’s crawlable... unless server side rendered. If like me you’re doing this on the client it won’t work. Shame but never mind ay! |
@PaulieScanlon yeah, I realized this a little later. Sorry! |
Is there any other solution I can consider to solve FB problem when using react-helmet on front-end. |
@lipenco Convert your app to server-side rendering Use a pre-rendering service Pre-render on your own In the end, I ended up using react-snap to render static files, and it hardly changed my build workflow. This was sufficient for me! Any others I'm missing? Edit 07/20/18: I've recently started hosting on Netlify (which has an option to turn on prerendering) to remove |
Be sure to check the Facebook Crawler Docs & the debugger to get more insight on how it crawls the content. Helped me better understand what's going on: https://developers.facebook.com/docs/sharing/webmasters/crawler |
In our case, a GTM trigger caused an This didn't scrape all og tags: 😭
After removing the trigger that added the iframe, the prerendered HTML was valid again. All og tags were being scraped again. 🚀
|
@ChristiaanScheermeijer We are experiencing the same issue. Can I ask what the GTM trigger was and if you modified your implementation of it or just completely removed it? I can't see an option where I can just remove our page view events from happening as that is really the only thing being triggered. Any insight would be greatly appreciated. |
Hi @smschick, At first, we've removed the trigger completely. However, since we really needed the trigger to work, we enabled it again and temporarily (until Netlify fixes the bug) removed the But beware for some unpredictable side-effects while doing so. Especially in older browsers. In our case, it was a Floodlight trigger. But it could be caused by any trigger who adds an iframe to the page. |
Hi, I can confirm that this is still an issue. Facebook developer tools only sees the following when it crawls our home page:
Even though opening up inspector in a browser shows all of the meta tags present. Our un-ideal workaround was to hard code our meta og and twitter tags into index.html. |
Hi there, I've just started using Helmet to implement meta tags, so apps like Facebook and Twitter can get some useful information about my page and put it into previews. However, I notice that there is a delay between when I render a page, and when the meta tags/title get set on the page. This seems to be causing Facebook and Twitter to miss the tags, as they are not present at the instant of page load. I'm wondering if I am doing something wrong, or there is a fix I am not aware of.
I am currently using the recommended server-side technique - IE
I'm using express. And I have confirmed that when I hard code in the description (that is, it is helmet-independent), FB picks up the data.
I really like the package, but if it doesn't take care of this kind of thing, I am afraid I'll have to roll my own architecture for tags like these. Any insight would be appreciated!
Thanks,
Sam
The text was updated successfully, but these errors were encountered: