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

Helmet does not correctly work for facebook scraper #5471

Closed
nealoke opened this issue May 18, 2018 · 5 comments
Closed

Helmet does not correctly work for facebook scraper #5471

nealoke opened this issue May 18, 2018 · 5 comments

Comments

@nealoke
Copy link

nealoke commented May 18, 2018

Description

Unfortunatly the scraper of Facebook does not pick up the correct meta tags created with the helmet plugin for pages which are not the index. The tags the scraper picks up are only from the index page

Example /index.js

<Helmet>
    <meta
        name="description"
        content="My index page description"
    />
</Helmet>

Example /mypage.js

<Helmet>
    <meta
        name="description"
        content="My other page's description"
    />
</Helmet>

Steps to reproduce

Create a gatsby project, create a meta tag within the helmet component for 2 pages namely an index page and an other page. Build it, host it and try to scrape the other page with the facebook tool (set the q parameter in the url)

Expected result

Should pick up the meta tags you created in the helmet component for the other page.

Actual result

Scraper only gets the meta tags from the index page

Environment

  • Gatsby version (npm list gatsby): 1.9.260
  • gatsby-cli version (gatsby --version): Not installed
  • Node.js version: v6.9.4
  • Operating System: Windows 10

File contents (if changed)

See my gist for these files

@KyleAMathews
Copy link
Contributor

Is there any console errors?

@nealoke
Copy link
Author

nealoke commented May 18, 2018

@KyleAMathews none when building and none when hosted 😢

@nealoke
Copy link
Author

nealoke commented May 18, 2018

Also note that the generated HMTL page contains the correct meta tags. For some reason they change when being scraped 😒

@jkarttunen
Copy link

Why is Title and Metadata defined in gatsby-config.js? Shouldn't that be page-level metadata, not site level metadata?

@nealoke
Copy link
Author

nealoke commented May 21, 2018

Thanks everybody for your help but I've found why this was occuring namely having my .htaccess file on the server with the following rule. Removing this fixed the issue

RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-f
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-d
RewriteRule ^ /index.html [L]

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

3 participants