Skip to content

fix: include docs base path in AI menu links - #62

Merged
zherring merged 4 commits into
mainfrom
centaur/fix-markdown-twin-links-1792097174
Oct 16, 2026
Merged

zherring merged 4 commits into
mainfrom
centaur/fix-markdown-twin-links-1792097174

Conversation

@splits-gerard

@splits-gerard splits-gerard commented Oct 15, 2026 •

Copy link
Copy Markdown
Collaborator

Problem

The Vocs "Ask AI" menu and the "Copy page for AI" button on every docs page ignore the /docs base path. The docs are served under /docs, so four things are broken on production today:

  • Copy page for AI (button and menu item) fetches /assets/md/<page>.md, which returns 404 on splits.org. The menu item then falls back to copying the page URL.
  • View as Markdown opens the same 404 path.
  • ChatGPT and Claude send a prompt that links to https://splits.org/workspaces/roles, without /docs. That page does not exist.
  • Copy page URL fallback has the same missing prefix.

Fix

Both changes are in patches/vocs.patch, because the menu is Vocs code and the repo already patches Vocs this way.

  1. The markdown URL builder takes the configured basePath and returns the public twin URL, so the fetch and "View as Markdown" request /docs/<page>.md. That is the URL llms.txt links, and it is served with max-age=0, must-revalidate. It deliberately avoids /docs/assets/md/<page>.md: Vercel serves everything under /docs/assets/ as immutable, max-age=31536000, and twins keep the same name across deploys, so browsers would keep a stale copy after a docs change.
  2. The page URL in AskAi is built from origin + base path + path, with a trailing slash (splits.org redirects the no-slash form), so the ChatGPT and Claude prompts and the copied link point at real pages.

Lockfile

Changing the patch changes its hash, and pnpm records that hash in pnpm-lock.yaml, so the lockfile has to change. Against main it is exactly three lines: the patch hash in patchedDependencies, in the importer entry, and in the vocs@2.3.2 snapshot key. No dependencies, versions, scripts or config change.

The first commit of this PR also carried an unrelated pnpm 11 rewrite of the lockfile (a different patchedDependencies format plus extra libc fields). Vercel installs with pnpm 10.x for this project, and that format failed with ERR_PNPM_LOCKFILE_CONFIG_MISMATCH. The follow-up commit regenerated the lockfile with pnpm 10.18.1 to drop that churn.

Testing

To test on this PR's Vercel preview:

  1. Open /docs/workspaces/roles/ and press ⌘I (Ctrl+I) to open the Ask AI menu.
  2. Click Copy page for AI and paste. Expected: the page's markdown, not a URL.
  3. Click View as Markdown. Expected: /docs/workspaces/roles.md opens in a new tab.
  4. Click Claude. Expected: the prompt links .../docs/workspaces/roles/.
  5. Click the Copy page for AI button under the page outline and paste. Expected: the same markdown.
Menu item Production This PR
Copy page for AI fetch /assets/md/workspaces/roles.md, 404 fetch /docs/workspaces/roles.md, 200
View as Markdown opens /assets/md/workspaces/roles.md opens /docs/workspaces/roles.md
ChatGPT, Claude prompt links splits.org/workspaces/roles prompt links .../docs/workspaces/roles/
  • A browser click-through on the preview at 6d05361 (with window.open and the clipboard stubbed) confirmed all three rows, when the markdown URL was still /docs/assets/md/<page>.md. 8c0589c moved it to /docs/<page>.md. That commit is verified by the checks below, not yet by a browser click-through.
  • pnpm install --frozen-lockfile passes on pnpm 10.18.1. The same install fails with main's lockfile and this PR's patch, which confirms the hash update is required.
  • pnpm build passes, including the prose lint and the internal link check. The preview's client bundle contains the new markdown URL builder and page URL.
  • On the preview, /docs/workspaces/roles.md and /docs/index.md return 200 with cache-control: public, max-age=0, must-revalidate. In vocs dev, /docs/workspaces/roles.md, /docs/index.md and /docs/workspaces.md return the markdown.
  • Not covered: only one page was clicked through in a browser.

Requested from Discord thread.

Prompted by: @zherring

🤖 Generated with Claude Code

@vercel

vercel Bot commented Oct 15, 2026 •

Copy link
Copy Markdown

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

Project Deployment Actions Updated
splits-docs Ready Ready Preview Oct 16, 2026 7:17pm UTC

Request Review

The Vercel build failed at install with ERR_PNPM_LOCKFILE_CONFIG_MISMATCH.
The lockfile had been written by pnpm 11 (bare patch hash, extra libc
fields), and Vercel installs with pnpm 10.x for this project. Regenerate it
with pnpm 10 so the frozen install matches.

Also patch the page URL that the AI menu copies and sends to ChatGPT and
Claude. It was built from origin + path and omitted the /docs base path.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@zherring zherring changed the title fix: include docs base path in markdown links fix: include docs base path in AI menu links Oct 16, 2026
@zherring
zherring marked this pull request as ready for review October 16, 2026 16:41
@zherring
zherring requested a review from mihoward21 October 16, 2026 16:41
splits.org redirects the no-slash URL, so the ChatGPT and Claude
prompts and the copied link now use the canonical trailing-slash form,
matching the canonical, sitemap, and llms.txt URLs.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Vercel serves everything under /docs/assets/ as immutable for a year, and
markdown twins keep the same name across deploys, so browsers would keep
showing a stale copy in Copy page for AI and View as Markdown. Use
/docs/<page>.md, the URL llms.txt links, which is served with
must-revalidate.

Also simplify the base-path prefix in the AI menu page URL.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@mihoward21

Copy link
Copy Markdown
Contributor

@zherring you can approve and merge whenever

@zherring zherring left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

lgtm

@zherring
zherring merged commit 83a2e5b into main Oct 16, 2026
5 of 7 checks passed
@zherring
zherring deleted the centaur/fix-markdown-twin-links-1792097174 branch October 16, 2026 19:39

This branch was successfully deployed

1 active deployment
Preview — 8c0589cd Deployed Oct 16, 2026 by vercel[bot]
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.

3 participants