Repository navigation
AR-20261104-2: canonical Link header + frontmatter on docs .md twins; drop /404/ from llms files - #989
Open
warp-agent-staging[bot] wants to merge 2 commits into
Open
AR-20261104-2: canonical Link header + frontmatter on docs .md twins; drop /404/ from llms files#989warp-agent-staging[bot] wants to merge 2 commits into
warp-agent-staging[bot] wants to merge 2 commits into
Conversation
… drop /404/ from llms files
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
Author
|
This PR was generated with Warp. Comment |
Replace the vercel.json catch-all, which also labelled 404 responses for any other .md request, with exact case-sensitive routes written into .vercel/output/config.json after the build. Tighten the twin validator and drop the transitive @vercel/routing-utils import.
Contributor
Author
|
Autoresearch gates: all passed (AR-20261104-2).
Preview links: /factories.md (see the frontmatter at the top; Posted by a Warp agent |
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


Problem
Every docs page has a Markdown twin at
/<path>.md(homepage/index.md), advertised on every HTML page with<link rel="alternate" type="text/markdown">. On production (checked 2026-11-04):curl -sI https://docs.warp.dev/factories.mdreturns200 text/markdownwith noLinkheader, so nothing tells a crawler that the twin duplicateshttps://docs.warp.dev/factories/.> For the complete documentation index, see [llms.txt]...) and has no YAML frontmatter. ora checkmarkdown-frontmatter= 0/1.llms-full.txtandllms-small.txtlisthttps://docs.warp.dev/404/as a documentation page.Change
Linkheader on generated twins only (vercel.jsonis unchanged):scripts/build-markdown-canonical-routes.mjsruns inpostbuild, afterscripts/build-tracking-middleware.mjs, and writes header routes into.vercel/output/config.jsonbefore the filesystem phase. A twin is<path>.mdwhose HTML page<path>/index.htmladvertises it with<link rel="alternate" type="text/markdown" href="/<path>.md">; 409 twins today./index.md→Link: <https://docs.warp.dev/>; rel="canonical". Every other twin →Link: <https://docs.warp.dev/<path>/>; rel="canonical". The twin paths are grouped into 5 exact alternation routes (eachsrcunder 3500 characters), allcaseSensitive: trueandcontinue: true..mdrequests (/assets/x.md,/_astro/x.md,/.well-known/x.md,/robots.md,/AGENTS.md, or any missing.md) return 404 with noLinkheader. HTML pages,/llms.txt,/openapi.*, and sitemaps get noLinkheader either.src/lib/markdown-canonical-routes.js.scripts/markdown-canonical-headers.test.mjs(npm run test:markdown-canonicalin CI) tests exact matches, reserved paths, missing files, near misses, case variants, regex characters, and route splitting. It also asserts thatvercel.jsonsets noLinkheader. The test needs no Vercel packages.src/integrations/docs-markdown-integration.js): the first bytes are---withtitle,description(omitted when the page has none), andcanonical(https://docs.warp.dev/<path>/, homepagehttps://docs.warp.dev/). Values are written as JSON strings, which YAML reads as double-quoted scalars, so colons, quotes,#, and leading-are safe. The body is otherwise unchanged. Unit tests cover quoting, omitted fields, nested paths, and the homepage.scripts/validate-markdown-twins.mjs(post-build,npm run test:markdown-twinsin CI) checks every sitemap page that advertises a twin. The page must have<link rel="canonical">, and the advertised href must equal the expected twin path. The twin must exist and start with frontmatter whosecanonicalequals both the sitemap URL and the HTML canonical. The routes inconfig.jsonmust give the twin exactly oneLinkheader with that URL, and 14 non-twin paths must get none./api/advertises no twin and is skipped..mdtwin (since [AR-20261028-3] Put the page description directly after the H1 and drop the hidden MDX copy #964). It now strips the frontmatter client-side (stripFrontmatterinsrc/lib/docs-markdown.js, unit-tested) so copied Markdown is byte-identical to before. Reason: the copied body already opens with the H1 title and description, so frontmatter would only duplicate them in a user's chat or notes. "View as Markdown" still opens the raw twin with frontmatter.'404'added to thestarlight-llms-txtexcludelist (with a comment).scripts/validate-llms-txt.mjs(post-build,npm run test:llms-txtin CI) fails if anyCanonical page: [..](url)inllms-full.txt,llms-small.txt, or_llms-txt/*.txtis not insitemap-*.xml.Hypothesis
Google supports
rel="canonical"HTTP headers for non-HTML documents (Consolidate duplicate URLs). With the header and matching frontmatter, ranking and citation credit for a twin consolidates on its HTML page instead of splitting across.mdURLs.Metric and prediction
markdown-frontmatter: 0/1 → 1/1 on the first production audit after deploy..mdURLs: at or below its 14-day pre-merge baseline over the 21 days after deploy. Falsified if it rises.Verification
Preview
https://docs-6yjh8b9ae-warpdotdev.vercel.app(headd01c41f), checked 2026-11-04:curl -sI https://docs-6yjh8b9ae-warpdotdev.vercel.app/factories.md→200 text/markdown,link: <https://docs.warp.dev/factories/>; rel="canonical"./index.md→<https://docs.warp.dev/>./agents.md→<https://docs.warp.dev/agents/>.Linkheader:/assets/not-a-twin.md,/_astro/not-a-twin.md,/.well-known/not-a-twin.md,/robots.md,/AGENTS.md,/Factories.md, and/not-a-twin.md(all 404), plus/factories/,/llms.txt,/sitemap-0.xml, and/openapi.yaml(200).<link rel="canonical">, and frontmattercanonicalequal to the same URL.llms-full.txtandllms-small.txt: 0 occurrences ofdocs.warp.dev/404/.verify_site.py --compare(production vs preview): 5 flagged items, allnew robots restrictions ['noindex'], caused by theX-Robots-Tag: noindexheader Vercel adds to every preview deployment. 0 regressions are attributable to this change.Exact-slug preview links: https://docs-6yjh8b9ae-warpdotdev.vercel.app/factories.md and https://docs-6yjh8b9ae-warpdotdev.vercel.app/llms-full.txt
Local checks
npm run typecheck,test:heading-vars,test:docs-markdown(16/16),test:markdown-canonical(5/5), AFDocs audit tests,test:tracking-redirect,test:agent-discovery,npm run build,test:heading-tocs,test:tracking-routes,test:homepage-json-ld,test:page-title-order,test:llms-txt(1244 entries across 14 files, all in sitemap),test:markdown-twins(409 twins and 14 non-twin paths OK), internal link check, redirect invariants: all pass.Risks
.vercel/output/config.json, the filescripts/build-tracking-middleware.mjsalready edits, so they rely on Vercel deploying that file as built. The preview confirms it.Accept: text/markdown) gets no canonical header; the HTML URL is already canonical, so nothing to consolidate.Experiment AR-20261104-2 · Conversation · Run