Skip to content

Docs Updates #2 - Stable IDs for Content + Redirects#666

Open
bryantgillespie wants to merge 10 commits into
bry/dockem-1-depsfrom
bry/dockem-2-stable-id
Open

Docs Updates #2 - Stable IDs for Content + Redirects#666
bryantgillespie wants to merge 10 commits into
bry/dockem-1-depsfrom
bry/dockem-2-stable-id

Conversation

@bryantgillespie
Copy link
Copy Markdown
Member

@bryantgillespie bryantgillespie commented Apr 28, 2026

This PR introduces stableId for all content to ensure we don't break URLs and links when re-arranging content. This is necessary because Nuxt Content auto generates IDs based on the the file path so changing the path (url) also generates a new ID for that content.

It also adds tooling scripts and support for automatically generating ids and redirects.


@vercel
Copy link
Copy Markdown

vercel Bot commented Apr 28, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
docs Ready Ready Preview, Comment May 14, 2026 3:53pm

Request Review

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds “stableId” frontmatter support and related tooling to keep Nuxt Content page identity stable across file moves, and introduces a redirects manifest + runtime routeRules loader to preserve old URLs.

Changes:

  • Add scripts to backfill/check stableId values and to generate/sync redirects.json based on moved/removed routes.
  • Configure git hooks (via postinstall) to auto-insert stable IDs on commit and validate redirects on push.
  • Load redirects.json into Nuxt/Nitro routeRules and extend the content schema to accept stableId.

Reviewed changes

Copilot reviewed 13 out of 14 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
scripts/tsconfig.json Adds a dedicated TS config for typechecking repo scripts.
scripts/setup-hooks.ts Configures .githooks as core.hooksPath during postinstall when appropriate.
scripts/_content-lib.ts Adds content scoping + minimal frontmatter parsing + stableId insertion helpers.
scripts/ensure-stable-ids.ts Script to insert missing stableId into (optionally staged) content files.
scripts/check-stable-ids.ts Script to validate presence/format of stableId across in-scope content.
scripts/redirects-sync.ts Script to diff routes vs a base ref and update/report redirect coverage.
.githooks/pre-commit Runs stable-id insertion for staged docs changes before commit.
.githooks/pre-push Runs redirects coverage check for docs-related changes before push.
redirects.json Adds initial redirect manifest file (currently empty).
nuxt.config.ts Loads redirects.json into Nitro routeRules; centralizes baseURL constant.
content.config.ts Extends content collection schema to allow stableId as a UUID.
package.json Adds tooling scripts, hook setup on postinstall, and Node engine constraint.
README.md Documents tooling commands and updates Node version requirement wording.
pnpm-lock.yaml Locks updated dependency graph (incl. @types/node alignment).
Files not reviewed (1)
  • pnpm-lock.yaml: Language not supported

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread scripts/_content-lib.ts Outdated
Comment thread scripts/redirects-sync.ts Outdated
Comment thread scripts/redirects-sync.ts Outdated
Comment thread .githooks/pre-push Outdated
Comment thread nuxt.config.ts Outdated
@bryantgillespie bryantgillespie requested a review from Copilot May 14, 2026 15:47
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 13 out of 14 changed files in this pull request and generated 3 comments.

Files not reviewed (1)
  • pnpm-lock.yaml: Language not supported

Comment thread scripts/redirects-sync.ts
Comment on lines +135 to +152
for (const old of basePages) {
if (currentPaths.has(old.path) || manifest[old.path]) continue;

if (!old.stableId) {
unresolved.push({ page: old, reason: 'no stableId in base ref', matches: [] });
continue;
}

const matches = (currentByStableId.get(old.stableId) ?? []).filter(p => p.path !== old.path);
if (matches.length === 1) {
resolved.push({ from: old.path, to: matches[0].path });
}
else if (matches.length > 1) {
unresolved.push({ page: old, reason: 'multiple current routes share stableId', matches });
}
else {
unresolved.push({ page: old, reason: 'no current route with same stableId', matches: [] });
}
Comment thread content.config.ts
Comment on lines 16 to 22
title: z.string(),
description: z.string().optional(),
headline: z.string().optional(),
stableId: z.string().uuid().optional(),
authors: z.array(z.object({
name: z.string(),
title: z.string(),
Comment thread .githooks/pre-push
exit 0
fi

echo "Checking redirects for docs changes..."
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