GatsbyのSEO

Gatsbyサイトを検索向けに最適化する方法を解説します。Gatsbyの4つのレンダリング方式(SSG、DSG、SSR、クライアント専用)、クロール可能性、最新のHead APIと従来のreact-helmet、サイトマップ、canonical、画像SEO、ReactバンドルによるCore Web Vitalsのコスト、Netlify時代のメンテナンスリスクを扱います。

初回公開:2026年6月26日 · 最終更新:2026年8月3日 · Advanced
言語
このページには証拠シグナルが1件あります

Gatsbyには4つのレンダリング方式があります。SSG(デフォルト)はgatsby buildでページを静的HTMLに事前レンダリングし、DSGは最初の要求時に遅延静的生成を行い、SSRはGatsby Functionsで要求ごとにサーバーサイドレンダリングを行い、クライアント専用ルートはブラウザーだけで描画します。多くのGatsbyサイトはSSGを使い、最初の取得でクローラーに完全なHTMLを渡せるため、純粋なクライアント側Reactアプリより強いSEOの基盤になります。ただしDSGとSSRはビルド手順の外でHTMLを生成し、クライアント専用ルートは初期HTMLにルート固有のコンテンツを出すとは限らないため、本番確認が必要です。どの方式でもGatsbyは完全なReactランタイム(約200KB以上)を送り、クライアント側でハイドレーションします。これはクロール可能性ではなくCore Web Vitalsのコストです。メタデータには組み込みのGatsby Head API(v4.19以降)を使います。主な落とし穴はcanonicalの二重化、下書きや孤立ページのサイトマップ流入、altテキスト不足、本番のみのサイトマップ、方式ごとの本番挙動確認、そしてNetlifyによる2023年の買収後にメンテナンスが大幅に鈍化したことです。

TL;DR — Gatsby 持つ four レンダリング options — SSG ( デフォルト), DSG, SSR, と クライアント専用ルート — と それら するn’t all put コンテンツ in raw HTML 同じ way. SSG pre-レンダリングs to 静的HTML at ビルド時 (gatsby build), so コンテンツ is in raw HTML 前に 最初の クローラー request — no 私たちb レンダリング Service, no レンダリング queue. DSG defers generation to 最初の request; SSR generates per request on server; クライアント専用ルート レンダリング ないhing route-specific until > ブラウザー runs JavaScript. どのever path serves ページ, Gatsby hydrates 完全な React bundle (~200KB+) on client, どの is Cまたはe 私たちb Vitals コスト, ない > クロール可能性 one. current metadata approach is built-in Gatsby Head API (v4,19+), どの wまたはks across all four レンダリング方式 と replaces gatsby-plugin-react-helmet. recurring failure modes are するuble できるonical tags (Head API + React-helmet both firing), draft/またはphan ページs leaking into サイトマップ, 本番-only サイトマップ gotcha, missing altテキスト on GatsbyImage, trailing-slash inconsistency, と DSG/SSR/クライアント専用ルート その 決して got > 本番 check. と elephant in room: since Netlify’s 2023 買収, Gatsbyの メンテナンス 持つ slo私たちd sharply.

Gatsbyの4つのレンダリング方式 — SEOに重要な理由

Google processes JavaScript ページs in three p持つes — crawling, then レンダリング, then インデックス登録 — と レンダリング happens in separate pass from queue 使用する headless Chromium. Google’s own guidance is blunt about なぜ あなた すべきn’t lean on その: “Server-side or pre-rendering is still a great idea because it makes your website faster for users and crawlers, and not all bots can run JavaScript.”

“Server-side or pre-rendering is still a great idea because it makes your website faster for users and crawlers, and not all bots can run JavaScript.”(日本語訳:引用内容を日本語で示します)

Gatsby サイト isn’t universally ビルドする-time 静的HTML — Gatsby suppまたはts four distinct レンダリング方式, chosen per ページ または template Evidence for this claim gatsby build writes production output, including generated HTML, to the public directory. Scope: Gatsby production builds. Confidence: high · Verified: Gatsby CLI: build :

“gatsby-seo-advanced-build”(日本語訳:引用内容を日本語で示します)

  • SSG (静的サイト生成) — デフォルト. gatsby build emits 完全なy レンダリングされた 静的HTML into /public fまたは ページ. Googlebot’s 最初の-wave raw-HTML fetch already contains complete コンテンツ — テキスト, リンク, metadata. この is safe, low-リスク path, と it’s 何 大半の Gatsby ページs 使う.
  • DSG (遅延静的生成). Generation is deferred until ページ’s 最初の request rather than happening fまたは すべての ページ at ビルド時 — 使うful fまたは サイトs with huge numbers of low-traffic ページs where 完全な ビルドする する be 遅い. ビルドする alone する ない tell あなた 何 クローラー sees; ページ’s HTML するn’t exist until something requests it, so 最初の-request と cached behaviまたは 必要がある their own check, ない just ビルドする log.
  • SSR (Server-Side レンダリング). ページ is レンダリングされた per request, 使用する request-time data, via Gatsby Functions. なぜなら it runs at request time, SSR ページs 必要がある 本番 checks ビルドする-time ページ するn’t: response status, caching headers, timeout behaviまたは, と 何 クローラー sees on 空の または errまたは response — none of その is visible from successful local ビルドする.
  • クライアント専用ルート. これらの レンダリング entirely in ブラウザー と するn’t get route-specific コンテンツ in initial HTML — 同じ profile as plain クライアント側 React app. するn’t assume Google (または any クローラー) sees anything ページ-specific here until JavaScript runs; treat これらの as JS-dependent by design, どの is fine fまたは gated/authenticated コンテンツ ただし wrong fまたは anything あなた want インデックス登録された with コンテンツ.

React hydration (ReactDOMClient.hydrateRoot()) happens クライアント側 on top of どのever of これらの produced HTML, purely to 追加する interactivity — その part is 同じ regardless of レンダリング方式, と is separate concern from どの path generated ページ (mまたはe on hydration コスト below).

Contrast SSG/DSG/SSR with pure クライアント側 React app, どの serves 空の <div id="root"> と depends on ブラウザー (または レンダリングer) to ビルドする ページ. 大半の Gatsby ページs ship 意味するingful HTML by デフォルト — その’s インデックス可能性 win, と it’s real, ただし it’s per-ページ property, ない framewまたはk guarantee. レンダリング options と 画像 tooling するn’t guarantee Cまたはe 私たちb Vitals, インデックス登録, または rankings on their own; verify actual 本番 output fまたは どのever path route 使うs.

catch with SSG/DSG/SSR alike is パフォーマンス one, ない クロール可能性 one: Gatsby ships 完全な React runtime to すべての ページ と re-hydrates it. Mまたはe on その, と Astro comparison, below.

Gatsby Head APIとgatsby-plugin-react-helmetの比較

この is 単一の 大半の 重要な “are you doing it the modern way?” question in Gatsby SEO.

“are you doing it the modern way?”(日本語訳:引用内容を日本語で示します)

** 従来の approach — gatsby-plugin-react-helmet.** Fまたは years, stとard way to set <title>, meta description, と other headタグ was react-helmet library plus この plugin. plugin’s job was to give React-helmet SSR suppまたはt — なしで it, あなたの title/metaタグ する only appear 後に JS execution, ない in raw HTML, どの defeats point. It wまたはks, ただし it 持つ 知るn 問題s with React Hooks と concurrent レンダリング, plus background-tab title bug あなた patch with defer={false}.

** 最新の approach — Gatsby Head API (v4,19+).** Gatsby now 持つ built-in way to 追加する head elements: named Head expまたはt from any ページ または template file. Evidence for this claim Gatsby pages and templates can export a named Head function to add head elements. Scope: Gatsby Head API. Confidence: high · Verified: Gatsby: Head API

“gatsby-seo-advanced-head”(日本語訳:引用内容を日本語で示します)

export const Head = () => (
  <>
    <title>Page Title</title>
    <meta name="description" content="..." />
  </>
)

It receives 使うful props — location.pathname, params, data (from ページ’s GraphQL query), と pageContext — と it deduplicates tags その share id prop (last one wins), though running two 異なる head-tag mechanisms at once (Head API plus leftover React-helmet call) できる still conflict even with deduplication. It wまたはks only in ページ files と templates, ない in arbitrary components. advantages over React-helmet: no third-party bundle, no Provider wrapper, deterministic tag またはder with React 18 streaming. 使う Head API fまたは all new projects, と plan migration fまたは 既存の ones.

Head API wまたはks 同じ way across all four レンダリング方式 — SSG, DSG, SSR, と クライアント専用ルート all suppまたはt Head expまたはt. 何 differs is when its output lとs in HTML クローラー できる fetch: on SSG it’s baked in at ビルド時; on DSG と SSR it’s generated at 最初の-request または per-request time; on client-only route it isn’t in initial HTML at all. するn’t assume “I added a Head export” is equivalent to “this is in the raw HTML for every route” — check actual 本番 output (view-source: または curl) fまたは どのever path 各 route 使うs, ない just one representative ページ.

“I added a Head export”(日本語訳:引用内容を日本語で示します) “this is in the raw HTML for every route”(日本語訳:引用内容を日本語で示します)

** “meta tags in DevTools but not in source” bug.** classic Gatsby SEO symptom: あなたの title/metaタグ sどのように up in Chrome DevTools ただし are missing from view-source:. ca使う is その DevTools sどのようにs hydrated するM (後に JS runs), 一方で view-source sどのようにs raw HTML. If あなたの tags only appear in DevTools, あなたの SEO component is レンダリング クライアント側 instead of being baked into Gatsbyの static output — usually なぜなら it’s 使うd as regular component rather than as (または inside) ページ’s Head expまたはt. 常に verify in raw HTML, ない DevTools.

“meta tags in DevTools but not in source”(日本語訳:引用内容を日本語で示します)

SEOコンポーネントの接続(GraphQLデータレイヤー)

Gatsbyの データレイヤー is GraphQL, と it’s どのように あなた feed metadata into あなたの ページs.

  • useStaticQuery pulls global デフォルトs from siteMetadata (title, description, siteUrl) defined in gatsby-config.js.
  • ページ-level GraphQL queries pass data prop straight to Head expまたはt — no extra wiring 必要があるed.
  • stとard pattern is prop || サイトMetadata fallback: 使う per-ページ value if it exists, otherwise サイト デフォルト.

Head expまたはt その takes ページ data looks like:

export const Head = ({ data }) => (
  <>
    <title>{data.post.title}</title>
    <meta name="description" content={data.post.excerpt} />
  </>
)

サイトマップ:gatsby-plugin-sitemap(落とし穴を含む)

Install gatsby-plugin-sitemap と configure it in gatsby-config.js. few things trip people up:

  • It generates sitemap-index.xml, ない /sitemap.xml. Submit インデックス URL in Google 検索 Console — するn’t submit /sitemap.xml と expect it to resolve.
  • It only runs in 本番 ビルドする. It する ないhing in gatsby develop. To test it, run gatsby build && gatsby serve. People file “my sitemap is missing” repまたはts その are really just “I never ran a production build.”
  • createLinkInHead: true by デフォルト 追加するs サイトマップ reference to HTML head 自動的に.
  • It 常に excludes /dev-404-page, /404, と /offline-plugin-app-shell-fallback.
  • <priority><changefreq> are ignまたはed by Google — plugin するcs say so directly. Focus on accurate <lastmod> instead.
  • entryLimit デフォルトs to 45 000 URL per file.

“my sitemap is missing”(日本語訳:引用内容を日本語で示します) “I never ran a production build.”(日本語訳:引用内容を日本語で示します)

Excluding drafts is あなたの job. Gatsby ビルドする すべてのthing it 見つけるs, so draft コンテンツ sails straight into サイトマップ unless あなた filter it. する その in gatsby-node.js with GraphQL filter (e.g. excluding entries なしで publish date), ない by hiding it in React component — by then it’s already built と listed.

DSG, SSR, と クライアント専用ルート 必要がある explicit サイトマップ decision. gatsby-plugin-sitemap reflects 何 it できる see at ビルド時. SSG ページ is straightfまたはward — it exists as static file, so it’s naturally サイトマップ-eligible. DSG ページ’s HTML するn’t exist yet at ビルド時 (it generates on 最初の request), SSR ページ 決して 持つ fixed HTML at all, と クライアント専用ルート 持つ no route-specific コンテンツ to インデックス in 最初の place. するn’t assume any of これらの are in サイトマップ (または すべき be) just なぜなら route exists — decide, ページ by ページ, whether it belongs, と verify generated sitemap-index.xml actually reflects その decision rather than ビルドする-time guess.

robots.txt:gatsby-plugin-robots-txt

gatsby-plugin-robots-txt generates robots.txt at ビルド時. 使うful detail fまたは SEO is environment awareness: it reads process.env.GATSBY_ACTIVE_ENV then process.env.NODE_ENV, so あなた できる serve 異なる rules per environment. classic 使う is blocking クローラー on Netlify preview/branch deploys so あなたの staging URL するn’t get accidentally インデックス登録された, 一方で leaving 本番 open.

canonical URL(canonicalが二重になるバグを含む)

利用できるアプローチは2つです:

  1. gatsby-plugin-canonical-urls 追加するs <link rel="canonical"> to すべての ページ. Set stripQueryString: true so /blog?tag=foo/blog するn’t get treated as separate できるonical化された ページs — 推奨 fまたは 大半の サイトs.
  2. ** Head API**, setting できるonicals あなたのself from location.pathname:
export const Head = ({ location }) => (
  <link rel="canonical" href={`https://example.com${location.pathname}`} />
)

** するuble できるonical bug.** この is 知るn, easy-to-hit 問題: if あなた 使う gatsby-plugin-canonical-urls React-helmet できるonical tag at 同じ time, あなた emit two <link rel="canonical"> tags. Pick one mechanism. (If あなた’re on React-helmet, gatsby-plugin-react-helmet-canonical-urls is helmet-aware option; on Head API, set できるonical there と drop plugin.)

Trailing slashes. Gatsby ページs できる be r各able with と なしで trailing slash, と Gatsbyの <Link> component 使うs クライアント側 Histまたはy API routing — どの bypasses server-side 301 redirects あなた’d nまたはmally 使う to nまたはmalize trailing slashes. Decide on one fまたはm, enfまたはce it at host/CDN level, と keep できるonicals consistent with it.

画像SEO:gatsby-plugin-image

gatsby-plugin-image is genuinely one of Gatsbyの strengths. Two components:

  • StaticImage — fまたは 画像 whose path is 知るn と hardcoded at ビルド時.
  • GatsbyImage — fまたは dynamic 画像 coming from GraphQL.

何 it する 自動的に: multiple sizes, 私たちbP/AVIF fまたはmats, lazy loading, と breakpoints (750/1080/1366/1920px). It also generates placeholders (blurred, するminant colまたは, または traced SVG) その reserve space と prevent Cumulative Laあなたt Shift — Cまたはe 私たちb Vitals 指標. なぜなら dimensions are set, あなた avoid CLS, と 最新の fまたはmats plus lazy loading help LCP.

** one thing it する ない する is write altテキスト.** その’s on あなた, すべての time — missing altテキスト on GatsbyImage is one of 大半の よくある Gatsby SEO oversights. (Migrating from old gatsby-image package? There’s codemod: npx gatsby-codemods gatsby-plugin-image.)

構造化データ(JSON-LD)

Google’s preferred structured-data fまたはmat is JSON-LD, と clean way to 追加する it in 最新の Gatsby is via Head API with script tag:

export const Head = ({ data }) => (
  <script type="application/ld+json">
    {JSON.stringify({
      "@context": "https://schema.org",
      "@type": "Article",
      "headline": data.post.title,
    })}
  </script>
)

gatsby-plugin-next-seo offers pre-built JSON-LD components if あなた’d rather ない hと-roll them. One frequent confusion to clear up: gatsby-plugin-manifest is ない structured-data plugin — it generates PWA 私たちb app manifest (icons, theme colまたは), ないhing to する with schema.

ReactバンドルとCore Web Vitals

Here’s Gatsbyの real 私たちakness relative to zero-JS generatまたはs.

  • 完全な hydration ( Gatsby 1–4 デフォルト) hydrates entire React tree と ships 200KB+ React runtime to すべての ページ. HTML is pre-レンダリングされた, so この するn’t hurt クロール可能性 — ただし it absolutely affects load speed と CWV.
  • Partial hydration (Gatsby 5, experimental) hydrates only components marked "use client" と leaves rest as 静的HTML, cutting JS shipped と directly improving TTI と CWV. limitations are real: 本番 ビルドする only, still beta, と incompatible with emotion, styled-components, と gatsby-plugin-offline.

takeaway: Gatsbyの JS payload is パフォーマンス problem, ない インデックス可能性 one. Googlebot still レンダリングs JS to assess ページ-experience signals, so bundle できる コスト あなた on CWV even though あなたの コンテンツ インデックスes fine.

SEOにおけるGatsbyとAstroの比較

If あなた’re choosing static framewまたはk today, この is comparison その matters 大半の fまたは SEO.

DimensionGatsbyAstro
JS shipped to ブラウザー200KB+ (完全な React runtime)~5KB (interactive islとs only)
レンダリング modelSSG → SPA (完全な hydration)SSG → MPA (zero hydration by デフォルト)
ビルドする speed (40 ページs)2–3 minutesUnder 10 seconds
SEO plugin ecosystemMature (gatsby-plugin-*)Growing
Crawl-budget impactHigher (mまたはe JS fまたは Google to レンダリング)Lo私たちr
Framewまたはk 将来Uncertain (Netlify ownership, slo私たちd activity)Active, growing

Both pre-レンダリング インデックスable HTML — その’s wash. difference is JS tax: Astro’s islとs ship fraction of JavaScript, どの Vaihe comparison frames as “Reduced JavaScript execution conserves crawl budget and accelerates page scanning.” (One histまたはical caveat on other side: Astro’s 画像 hとling lacked automatic width/height at time of その comparison, どの produced Lightho使う warnings — check current Astro するcs, as it may be resolved.)

“Reduced JavaScript execution conserves crawl budget and accelerates page scanning.”(日本語訳:引用内容を日本語で示します)

Fまたは conテキスト on どのように whole field compares, see static サイト generatまたはs hub.

正直な話:Gatsbyのメンテナンス状況

I won’t sugarcoat この, と I won’t catastrophize it either.

Netlify 買収した Gatsby Inc. in 2月 2023. Gatsby Cloud was sunset と customers 私たちre moved to Netlify; Netlify stated 買収 する “not impact Gatsby JS.” Since then, activity 持つ slo私たちd markedly. widely-read community GitHub discussion (#39062) argues Gatsby is effectively abとoned — minimal commits, no React 19 suppまたはt, 2024 roadmap その wasn’t delivered, と telemetry service shut するwn. Maintainers 持つ framed current state as security fixes, limited dependency updates, と low-hanging-fruit bug fixes.

“not impact Gatsby JS.”(日本語訳:引用内容を日本語で示します)

何 その 意味する fまたは SEO teams. Fまたは 既存の Gatsby サイト, none of この is emergency — it ビルドする, it インデックスes, it wまたはks. リスク is ecosystem decay over time: SEO depends on plugins (gatsby-plugin-sitemap, 画像, できるonical-URL), と aging plugins (e.g. gatsby-source-shopify facing API deprecation) できる eventually break in ways その quietly degrade インデックス登録. Fまたは new project, 私たちigh その seriously — framewまたはks people are migrating to are Astro と Next.js.

本番チェックリスト:すべてのレンダリング方式を検証する

local gatsby develop session または even clean gatsby build log するn’t prove 何 クローラー actually receives. なぜなら SSG, DSG, SSR, と クライアント専用ルート 各 generate HTML 異なるly, check 本番 behaviまたは per path rather than assuming one representative ページ covers all of them:

  • Raw HTML コンテンツ. Fまたは 各 レンダリング方式 in 使う, fetch real 本番 URL with curl -s <url> または view-source: — ない DevTools — と confirm コンテンツ, title, と metaタグ クローラー する see are actually there.
  • Metadata (Head expまたはt output). Confirm Head expまたはt’s tags lと in その raw HTML fまたは path in question. この is where DSG/SSR differ 大半の from SSG: tags exist in あなたの source either way, ただし only 本番 fetch proves それら made it into response.
  • HTTP status. Check response status code on 本番, especially fまたは SSR と DSG routes — ページ その レンダリングs fine locally できる 500 in 本番 on 最初の request または under load in ways ビルドする 決して surfaces.
  • Caching behaviまたは. SSG output is static file with predictable caching. DSG caches 後に 最初の request — confirm second request is 高速な と cまたはrect, ない just 最初の. SSR responses depend on あなたの caching headers と hosting layer; verify stale または per-request コンテンツ isn’t served to wrong visitまたは.
  • Failure と 空の-state behaviまたは. Fまたは SSR と DSG ページs backed by request-time または 最初の-request data, check 何 クローラー sees if その data fetch fails または returns 空の — unhとled errまたは state is ない 同じ ページ あなた tested locally with 良い data.
  • サイトマップ generation と exclusions. Re-confirm この only happens on 本番 ビルドする (gatsby build && gatsby serve, 決して gatsby develop), と その exclusions あなた expect — drafts, クライアント専用ルート, anything あなた decided すべきn’t be listed — are actually absent from generated sitemap-index.xml, ない just absent from あなたの intent.

None of この is optional per レンダリング方式 — wまたはking gatsby build proves SSG output, ない DSG, SSR, または client-only behaviまたは.

Gatsby SEOでよくある間違い

  1. Still 使用する gatsby-plugin-react-helmet — 従来の; migrate to Head API.
  2. metaタグ in DevTools ただし ない in ページ source — SEO component is レンダリング クライアント側; check view-source:, ない DevTools.
  3. Draft コンテンツ in サイトマップ — filter drafts in gatsby-node.js with GraphQL, ない in React component.
  4. またはphan ページs from src/pages — Gatsby auto-routes すべてのthing there; stale files ビルドする と lと in サイトマップ.
  5. するuble できるonical tagsgatsby-plugin-canonical-urls + React-helmet both firing.
  6. Trailing-slash inconsistency<Link> client-routing bypasses server-side trailing-slash redirects.
  7. ない stripping query strings from できるonicals — set stripQueryString: true.
  8. altテキスト omitted on GatsbyImage — it isn’t auto-generated.
  9. Submitting /sitemap.xml — real file is /sitemap-index.xml.
  10. Testing サイトマップ in gatsby develop — it only generates on gatsby build.
  11. Noインデックス toggled by React state — Google may 持つ already processed raw HTML; と when it sees noindex in raw HTML it may skip レンダリング entirely. Keep noインデックス decisions in 静的HTML または server headers.

Fまたは JavaScript-レンダリング fundamentals behind all of この, see parent JavaScript SEO hub.

Add an expert note

Pin an expert quote

New person? Create their unclaimed profile at /admin/experts/ → Pin a quote first.