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
Metatags from helmet are not recognized by google, neither social medias! #9979
Comments
We'd need code snippets or your repository to see what's happening there. (As per the issue template you saw) |
<I18nextProvider i18n={i18n}>
<Fragment>
<Helmet title={data.site.siteMetadata.title}>
<link
href="https://fonts.googleapis.com/css?family=Montserrat:400,500,700,800"
rel="stylesheet"
/>
<link
rel="stylesheet"
href="https://cdnjs.cloudflare.com/ajax/libs/animate.css/3.5.2/animate.min.css"
/>
<link rel="shortcut icon" type="image/ico" href={icon} />
<html lang="en" />
<meta
name="description"
content={description ? description : defaultMetaTags.description}
/>
<meta
name="keywords"
content="SWC Summit, SWCSUMMIT, StartUp, Start Up, Competition, StartUp Competition, Vysehrad, Congress Centre, Congress Hall, Inventi"
/>
<meta
property="og:title"
content={title ? title : defaultMetaTags.title}
/>
<meta
property="og:description"
content={description ? description : defaultMetaTags.description}
/>
<meta
property="og:image"
content={image ? image : './assets/img/summit_logo_text.png'}
/>
...........rest This dynamic metatags are just recent update. It does not work even if the metatags are hardcoded. If You need another snippet from some file, please tell Me. |
I fear that code snippet is kinda vacuous. I don't know your setup but an overview of every complete file which is involved in this would be better. As a side note: |
Your problem might be related to this issue: nfl/react-helmet#79 Apparently the 'data-react-helmet' that RH adds to meta tags causes problems with AMP and possibly Facebook, Googlebot, etc. |
@jakubrohleder is your project live? If so can you share a link or reproduce this issue? Also can you make sure you also have plugins: [
`gatsby-plugin-react-helmet`
...
] |
Hi, thanks for answering. Right now, I'm trying to figure it out, how to get rid of the data-react-helmet attributes. Do You have some hint for me, how to achieve it with gatsby? Right now, I'm trying something like this in gatsby-ssr.js:
But it's not working. |
I can't confirm this. I use react-helmet on every site and never had any issues with previews, Facebook's share debugger etc. |
Hiya! This issue has gone quiet. Spooky quiet. 👻 We get a lot of issues, so we currently close issues after 30 days of inactivity. It’s been at least 20 days since the last update here. If we missed this issue or if you want to keep it open, please reply here. You can also add the label "not stale" to keep this issue open! Thanks for being a part of the Gatsby community! 💪💜 |
Not stale. I'm currently running a Gatsby site and the meta tags generated by Helmet are not being picked up by Google. The meta description is not rendering correctly in search results. |
I have the same problem. When sharing the website no preview is being displayed. When using Facebook debugger (https://developers.facebook.com/tools/debug/sharing/) is says: Inferred Property Missing Properties |
We solved this issue.. by migrating to Next :D it was resolved out of the box |
@Jornve are you able to reproduce? Similarly, @fab could you provide anything so I could take a look? URLs would be fine, but source code would be even better. One thing we've seen before is that some invalid JavaScript (e.g. a non-transpiled node_module containing an arrow function) can often cause things to go awry in the crawlers/parsers for SEO--particularly in Googlebot with an old version of Chrome. However - this seems to be working just fine in a few sample Gatsby apps I just spot-checked. That being said--it's possible some of you are hitting an edge case that we haven't been able to reproduce, that's why a reproduction is so valuable! If you're not able to reproduce, like I said, a URL would be valuable as would a peek at your Additionally, see @jlengstorf's blog Thanks! |
For reference, these two components are reusable and handle SEO pretty well for me: https://github.com/jlengstorf/gatsby-theme-jason-blog/tree/master/src/components/SEO |
Strangely I no longer have this issue, although I did install Google Search Console on the domain since posting this. At first the Google search results were not picking up the meta description tag correctly but that appears to be sorted now. For anyone running into this problem I would suggest looking at @jlengstorf's SEO components, that's what I modelled mine on, and also using Google Search Console to manually crawl your site. |
@Jornve been a few days, so going to close this out. As @jlengstorf said though, if you are still having this issue please reply and we'll re-open the issue and take another look. Thanks all for using Gatsby 💜 |
I am also having this problem on my site, and cant seem to get around the issue... Have we managed to get to the bottom of this.. |
have you found a solution for this ? |
Well, I did. Migration to NextJS. |
After working on this on and off over the last week I've finally figured it out on my project. I made a mistake resulting in 55k lines (after it was formatted) of embedded CSS in a (If it's helpful for anyone else here... In my case, I had some code in |
Thank you for sharing this. I believe we are having the same exact issue and this gives me some ammunition to get it fixed. |
I have written my own exports.onPreRenderHTML = ({ replaceHeadComponents, getHeadComponents }) => {
const headComponents = getHeadComponents();
console.log(headComponents);
headComponents.forEach(head => {
if (head.props && head.props['data-react-helmet']) {
delete head.props['data-react-helmet'];
}
});
replaceHeadComponents(headComponents);
}; |
For my case, I add tailwindcss without css purge :( |
I have the same issue: Google/Twitter/Facebook don't detect the meta data, although it's in there. I've compared the last deployment where everything seemed to work fine with the current one, which does not work fine. Edit: Somebody here ( nfl/react-helmet#79 (comment) ) is suggesting the exact opposite, and for gatsbyjs.com it works with data-react at the end, so this doesn't seem to be the cause. I've made a couple of changes between the last deployment where everything worked fine and the one that broke the social sharing.
I tried rolling back these but so far none of the rollbacks fixed the issue. I had also upgraded some dependencies back then, moving from Gatsby 2.21.0 to 2.21.12, in case that matters. |
I'm having the same issue with my site jonathanmadelaine.com. You can see the meta tags in the head, but when crawling using either the Facebook or Twitter debugger, those meta tags are not detected. Update:I made a comment in this thread that may identify the cause. It looks like it is related to rendering context providers in |
@jmadelaine's finding applied to me as well. In my case I had to move the SEO component not only outside of my theme provider but also outside of my context provider. |
If you keep the SEO inside, but switching the styles and the meta tag like this, is your problem solved? exports.onPreRenderHTML = function onPreRenderHTML({
getHeadComponents,
replaceHeadComponents,
}) {
const headComponents = getHeadComponents();
headComponents.sort((a, b) => {
if (a.type === b.type || (a.type !== 'style' && b.type !== 'style')) {
return 0;
}
if (a.type === 'style') {
return 1;
} else if (b.type === 'style') {
return -1;
}
return 0;
});
replaceHeadComponents(headComponents);
}; |
@malcolm-kee No in my case the order in the I think I've been able to resolve the mismatch and it seems to be working now again, with the SEO component inside of the Layout component or page templates respectively. Still have to deploy and test live, though. |
Can confirm that resolving the mismatch of SSR and Runtime solved the issue for me. A little note: Both, the Twitter Debugger and the Facebook Debugger didn't immediately show results after publishing the fix, so probably better to rely on checking public/index.html if the social graph/search tags there appear for debugging. |
Thank you @malcolm-kee This solved the issue for me! :) |
Hi, We're using Gatsby for Our websites, but we have to face quite big issue. All of our metatags passed to Helmet are ignored everywhere, Google, Yahoo, neither Facebook and other social medias. All of Our metatags are written correctly, followed by GatsbyJS and React-Helmet documentation. When checking the elements in the console, metatags are physically there, but they are ignored. When we move the metatags to html.js file, then it works correctly, but this is not what we want, because we need to set the meta tags dynamically corresponding to the route. Please, Anyone, could You kindly help Us with that? It's a real problem at this point of development. Thank You in advance!
The text was updated successfully, but these errors were encountered: