Skip to content

Docs SEO Update: Phase 1 - #1147

Merged
brandonleekramer merged 9 commits into
mainfrom
docs-seo-phase-1
Dec 4, 2026
Merged

brandonleekramer merged 9 commits into
mainfrom
docs-seo-phase-1

Conversation

@brandonleekramer

Copy link
Copy Markdown
Member

Summary

Fixes the docs findings from the December 2026 SEO audit (graph-gtm-kit/internal/seo-audit/december-2026-audit/thegraph-seo-audit.md), plus two issues found along the way. Each change is its own commit.

Indexing and crawling

  • Sitemap at /docs/sitemap.xml (audit finding 1). The build already ran next-sitemap, but the file never shipped: it was written to public/ after the static export, its URLs were relative, and nginx redirected /docs/sitemap.xml to an HTML page. It's now written into out/docs with absolute https://thegraph.com/docs/en/... URLs and served directly. The 404/500 pages are left out. sitemap-ci.js reads the new location, and the route lockfile keeps its format (only the /en/404/ line goes).
  • Real 404 status for missing docs pages. Missing /docs/en/ URLs showed the 404 page with status 200, which Google treats as a "soft 404". They now return 404 with the same page.

Head tags

  • Self-referencing canonical on every page (finding 2): https://thegraph.com/docs/en/<path>/, built from the route at export time. The 404 page gets none.
  • og:url per page. Every page declared og:url = https://thegraph.com/ (hard-coded in _app.tsx), so link previews treated each docs page as the homepage. It now equals the canonical.
  • Structured data (finding 9): BreadcrumbList and TechArticle JSON-LD on docs pages, and WebSite on the homepage. Helpers live in the new layout/seo.ts.

Headings

  • Supported Networks has an H1 (finding 7). The top heading is now an H1 styled like the old H2, and it reads "The Graph Supported Networks". The tab title and og:title match. The left nav and the homepage section heading still say "Supported Networks".
  • Each network detail page has an H1. The first heading of each network's content ("Indexing Data on Ethereum" and so on) is now the page's H1. It looks the same as before and keeps its anchor id. A network without custom content falls back to its name as the H1.

Notes for review

  • Rebased on fix(nginx): redirect to https, so none drops to http #1146. This branch originally had its own fix for the http:// redirect hop. fix(nginx): redirect to https, so none drops to http #1146 fixed the same thing on main, so this branch was rebuilt on top of it. The sitemap commit keeps fix(nginx): redirect to https, so none drops to http #1146's https://$host redirects and only adds sitemap\.xml to the locale-redirect exception.
  • Shallow breadcrumbs. Nav folders have no index pages, so most pages get Docs > Page. Network pages get Docs > Supported Networks > Network.
  • Last-updated dates. .dockerignore excluded .git, so the production build had no git history and pages never got a last-modified date. .git now stays in the build context (builder stage only; the final image is unchanged), so TechArticle gets dateModified and pages show the "Last updated" date the layout already renders. Templated pages (home, network pages, 404) get none.
  • Companion PR. The meta descriptions, homepage title and two content fixes are in a separate PR (docs-seo-phase-2). The two merge cleanly in either order.

Testing

  • nginx: ran the real config in nginx 1.24. /docs/sitemap.xml serves text/xml with no redirect, redirects go straight to https://, and missing /docs/en/ pages return 404 with the docs 404 page.
  • Sitemap: ran next-sitemap and sitemap-ci.js on route data from the lockfile. That produced 193 absolute URLs and no 404 entry, and the regenerated lockfile matches the committed one.
  • Rendered pages: checked in a dev server and headless Chromium:
    • canonical and og:url on the homepage, quick start, a deep manifest page, About, Supported Networks and network pages
    • every JSON-LD block parses
    • one H1 per page, styled the same as before
    • no hydration warnings
  • Code checks: pnpm lint and tsc pass, and prettier passes on the changed files.
  • Not run: a full production build/export. CI is the first one.

🤖 Generated with Claude Code

https://claude.ai/code/session_01HpT75vHTnTdhKizaBwz8Yq

brandonleekramer and others added 9 commits December 3, 2026 18:31
The build already ran next-sitemap, but the sitemap never reached
production: it was written to public/ after the static export had been
copied to out/docs, its <loc> values were relative (siteUrl '/'), and
nginx redirected /docs/sitemap.xml to /docs/en/sitemap.xml, which serves
the HTML 404 page.

- next-sitemap: absolute URLs under https://thegraph.com/docs, written
  into the export at out/docs, 404/500 pages excluded
- nginx: exempt /docs/sitemap.xml from the /docs/en/ locale redirect
- sitemap-ci.js: read the sitemap from its new location and keep the
  route lockfile's site-relative /en/... format
- route-lockfile: drop /en/404/, now excluded from the sitemap

Addresses finding 1 ("No valid XML sitemap anywhere") of the December
2026 SEO audit: graph-gtm-kit/internal/seo-audit/december-2026-audit/
thegraph-seo-audit.md

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HpT75vHTnTdhKizaBwz8Yq
The /docs/en/ location fell back to the 404 page inside `try_files`,
which serves it as a normal file with status 200. Every mistyped or
removed docs URL therefore looked like a valid page to crawlers, which
Google reports as a "soft 404" and can index.

`try_files` now ends in `=404`, and `error_page 404` shows the same
localized 404 page, so visitors see no difference but the status is 404.

Found while testing the redirect fixes for the December 2026 SEO audit
(graph-gtm-kit/internal/seo-audit/december-2026-audit/thegraph-seo-audit.md);
not one of its listed findings.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HpT75vHTnTdhKizaBwz8Yq
The Supported Networks page hides the content header that renders the
page title as an H1, and its top heading was an H2, so the page had no
H1 at all.

That heading is now a `Heading.H1`, with the same id. MDX content only
styles h2-h6, so it takes the H2 classes it had (size, white text, top
margin) explicitly, and looks as before.

Fixes finding 7 of the December 2026 SEO audit
(graph-gtm-kit/internal/seo-audit/december-2026-audit/thegraph-seo-audit.md).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HpT75vHTnTdhKizaBwz8Yq
No docs page declared a canonical URL, so search engines had to guess
which of a page's variants (with or without a trailing slash, with a
query string, through a redirect) to index.

Every page now has a `<link rel="canonical">` to its own absolute URL,
`https://thegraph.com/docs/en/<path>/`, always with a trailing slash and
never with a query string or hash (the home page is
`https://thegraph.com/docs/en/`). It is built in `Layout` from Nextra's
`useFSRoute`, the page's path, which is the same in the HTML rendered at
build time and in the browser. The docs' URL lives in one constant,
`DOCS_URL` in `src/layout/seo.ts`.

The 404 page, which is served for every missing URL, declares none.

Fixes finding 2 of the December 2026 SEO audit
(graph-gtm-kit/internal/seo-audit/december-2026-audit/thegraph-seo-audit.md).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HpT75vHTnTdhKizaBwz8Yq
`_app.tsx` gave every page `og:url` = `https://thegraph.com/`, so every
shared docs link told social networks and crawlers that it was the
homepage, and previews could merge or point there.

`_app.tsx` no longer sets it, and `Layout` sets `og:url` to the page's
canonical URL. The 404 page, which has no URL of its own, sets none.

Not one of the findings of the December 2026 SEO audit
(graph-gtm-kit/internal/seo-audit/december-2026-audit/thegraph-seo-audit.md);
found while adding the canonical tags for its finding 2.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HpT75vHTnTdhKizaBwz8Yq
The docs had no structured data, so search engines could not show
breadcrumbs for docs results or tell what kind of page each one is.

`Layout` now emits JSON-LD on every docs page:

- a `TechArticle` with the page's headline (its `og:title`, else its
  title), description, image, canonical URL, `inLanguage`, and The Graph
  as publisher. No `dateModified`: no real date is available yet (see
  the TODO about `timestamp` in `Layout`).
- a `BreadcrumbList` from the nav trail, starting with "Docs"
  (`https://thegraph.com/docs/en/`). Nav folders that have no page of
  their own are skipped rather than given made-up URLs; a network's page,
  which is not in the nav, gets Supported Networks as its parent.

The home page, a hub rather than an article, gets a `WebSite` instead,
and the 404 page gets none. `<` is escaped in the serialized JSON so it
can never close the script tag. The builders live in `src/layout/seo.ts`.

Fixes finding 9 of the December 2026 SEO audit
(graph-gtm-kit/internal/seo-audit/december-2026-audit/thegraph-seo-audit.md).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HpT75vHTnTdhKizaBwz8Yq
"Supported Networks" alone says nothing about whose networks they are,
in search results, in browser tabs, or in shared links.

The page's H1 now reads "The Graph Supported Networks", from a new
`index.supportedNetworks.pageTitle` string, and a front-matter `seo`
override gives it the same `og:title` and the tab title "The Graph
Supported Networks | Docs | The Graph" (so its `TechArticle` headline
matches too). The front-matter `title` and the
`index.supportedNetworks.title` string are unchanged, so the left nav,
the breadcrumbs and the home page's section heading still say
"Supported Networks".

Follows up on finding 7 of the December 2026 SEO audit
(graph-gtm-kit/internal/seo-audit/december-2026-audit/thegraph-seo-audit.md),
whose fix made this heading the page's H1.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HpT75vHTnTdhKizaBwz8Yq
Network detail pages (/supported-networks/<network>/) had no H1: the
network name is an h2, and so was the first heading of each network's
custom content ("Indexing Data on Ethereum" and so on).

- The first heading of every customContent file (88) is now a level-1
  heading, so it becomes the page's single H1.
- NetworkDetailsPage maps that h1 to Heading.H1 styled exactly like the
  h2 it replaced (content styles only target h2 and below), and keeps
  its anchor id (e.g. #indexing-data-on-ethereum), since Nextra only
  generates ids from h2 down.
- A network page without custom content falls back to the network name
  as its H1, so a future network can't ship without one.

The MDX heading lint (.remarkrc.mjs) only covers src/pages, so these
snippets aren't subject to its no-h1 rule. Checked in a dev server: one
H1 per page, same computed style as before, `pnpm lint` passes.

Addresses finding 7 of the December 2026 SEO audit, applied to the docs:
graph-gtm-kit/internal/seo-audit/december-2026-audit/thegraph-seo-audit.md

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HpT75vHTnTdhKizaBwz8Yq
…dates

Nextra reads each page's last-modified date from git while building, but
`.dockerignore` excluded `.git`, so the production image build never had
any history: `timestamp` was always undefined (hence the old "Why is
`timestamp` undefined?" TODO), no page showed its "Last updated" date,
and `TechArticle` had no `dateModified`.

- .dockerignore: keep `.git` in the build context. Only the builder stage
  sees it; the final image copies just `out/`. The Dockerfile already
  installs git, and the image workflow already checks out full history
  (fetch-depth: 0, blob:none), which Nextra's git reader handles: it gave
  the same dates on a blobless clone as on a full one.
- TechArticle gets `dateModified` from that date.
- Pages built from a template (`[locale]/...`: home, network pages, 404)
  get no date, since theirs would be the template file's, not their
  content's.

Visible effect: docs pages now show the "Last updated" date the layout
already renders when it has one.

Checked in a dev server: quick start and tokenomics show 2026-11-30
(their last commit, #1138) in both the page and `dateModified`; the
homepage and network pages show none.

Addresses finding 9 (structured data) of the December 2026 SEO audit:
graph-gtm-kit/internal/seo-audit/december-2026-audit/thegraph-seo-audit.md

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HpT75vHTnTdhKizaBwz8Yq
@brandonleekramer
brandonleekramer merged commit 0dbf525 into main Dec 4, 2026
4 checks passed
@brandonleekramer
brandonleekramer deleted the docs-seo-phase-1 branch December 4, 2026 14:43
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

Successfully merging this pull request may close these issues.

2 participants