Create an Accessible SEO Component using React Helmet

InstructorLaurie Barth

Share this video with your friends

Send Tweet

Add metadata to your gatsby-config file and query it using the useStaticQuery hook and the GraphQL template function.

React Helmet is a component that lets you control your document head using their React component. Install gatsby-plugin-react-helmet and use the Helmet component from react-helmet to pass in necessary information such as title, description, language, and titleTemplate.

Finally, use the meta keyword to add an array with targeted og and Twitter information.

Jack
~ 3 years ago

Hello Laurie, I have a general question concerning the whole course. Considering you've also added a small course on gatsby-theme-blog, are the two approaches equivalent? I mean, the entire setup as illustrated in this course and the setup that gatsby-theme-blog would make for us? If not what would be the differences between the two approaches? Thanks

Laurie Barthinstructor
~ 3 years ago

They’re roughly equivalent. When you use the theme you are leveraging all of that built in code to set up MDX, etc. it allows you to use an external url as a blog post image, for example. However, it also means that code doesn’t live in your project, so depending on how many changes you want to make, the approach in this course may make more sense.