RankpediaA plain-English encyclopedia of search

Gatsby SEO

Configures a Gatsby site so search engines can crawl, index, and display its pages effectively, using metadata, sitemaps, and static rendering.

If you assume a Gatsby site is automatically SEO-friendly because it's static, you may miss missing metadata, duplicate pages, or inconsistent URLs.

Key points

  • Generate and verify sitemap.xml and robots.txt after every build.
  • Ensure every page has a unique title tag and meta description.
  • Use absolute canonical URLs prefixed with the full site URL.
  • Exclude unwanted generated pages from the sitemap and indexing.
  • Check for trailing-slash consistency across links and canonical tags.

The same metadata, fifty pages

A developer built a Gatsby site with 50 blog posts but used the same title tag and meta description on every page. The sitemap contained 50 identical entries. After adding a reusable SEO component that pulled unique titles and descriptions from each post's frontmatter, Google Search Console showed distinct snippets for each page within a week. The fix took two hours and required only gatsby-plugin-react-helmet.

Three common mistakes that hurt Gatsby SEO

  • Identical page metadata Using the same title tag or meta description across many pages prevents search engines from showing relevant snippets. Each page needs unique, descriptive metadata.
  • Missing sitemap or robots.txt Forgetting to generate or verify these files after a build can leave pages undiscovered or allow crawling of unwanted sections. Use plugins to automate creation.
  • Unwanted generated pages Archive paths, tag pages, or temporary build files can end up in the sitemap. Exclude them from indexing and the sitemap to avoid duplicate content issues.

Three ways to verify your Gatsby SEO setup

  • Check title uniqueness Use an SEO extension or a crawling tool to scan every page and confirm that title tags and meta descriptions are distinct and relevant.
  • Test sitemap submission Submit your sitemap.xml in Google Search Console and check for errors or warnings. Verify that only intended pages appear.
  • Audit URL consistency Ensure internal links, canonical tags, and server behaviour all use the same trailing-slash format. Mixed formats create duplicate URL variants.

Common questions

Does Gatsby's static generation guarantee good SEO?

No. Static generation helps with speed, but you must still set per-page metadata, sitemaps, and robots rules for search engines to index content correctly.

How do I prevent duplicate pages in Gatsby?

Use canonical URLs with absolute URLs, exclude unwanted generated paths from the sitemap, and ensure trailing-slash consistency across all links.

Sources

  1. Gatsby SEO and social sharing cards tutorial Official tutorial on setting up metadata and social cards in Gatsby.
  2. Gatsby SEO mistakes article Covers common pitfalls like duplicate titles and missing sitemaps.
  3. Gatsby SEO guide Step-by-step guide to metadata, canonical tags, and sitemap generation.