Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I add Google Structured data on my gatsby website?

Tags:

gatsby

I want to add google structured data for my gatsby website. But I can't find any detailed information on that.

I tried to use google tag manager but it doesn't seems to work.

I am seeking for a way to add google structure data on my website. I want an article schema for all my pages except the home page. And FAQ schema for home page.

like image 809
Tahsin Kabir Khan Avatar asked Sep 10 '19 09:09

Tahsin Kabir Khan


People also ask

How do I add SEO to gatsby?

Add SEO to Page As a bare minimum, you should add a title and description. Example with just title and description: import React from 'react'; import { GatsbySeo } from 'gatsby-plugin-next-seo'; export default () => ( <> <GatsbySeo title='Simple Usage Example' description='A short description goes here.

Is gatsby SEO friendly?

Gatsby automatically provides drop-in support for server rendering of metadata and it'll be added to the static HTML pages that Gatsby produces. This helps your site rank and perform better in search engines. By the end of this guide you'll have a SEO component that you can use in your pages to define metadata.

How do I see structured data in Google console?

Monitoring overall structured data performance If you'd like to have an overall idea of all the errors for a specific structured data feature in your site, you can navigate to the Enhancements menu in the left sidebar and click a feature. You'll find a summary of all errors and warnings, as well as the valid items.


1 Answers

Looks like what you want is to combine the concepts of the SEO component, as described here: https://www.gatsbyjs.org/docs/add-seo-component/ and react-helmet's support for the script tag: https://github.com/nfl/react-helmet#reference-guide

The prismic starter by LekoArts does this. Here's the file for reference: https://github.com/LeKoArts/gatsby-starter-prismic/blob/master/src/components/SEO/SEO.jsx

Now to make them different for the home page vs your article pages, you'll likely need to amend the component to accept whatever data you want to pass down from the article.

like image 106
Mark Michon Avatar answered Nov 09 '22 03:11

Mark Michon