The "Copy Link" button on a case page builds the copied URL from a hardcoded string:
components/post/CopyLinkButton.tsx
navigator.clipboard.writeText(
`https://agentpostmortem.com/case/${caseNumber}`,
);
The repo already has a helper for this in lib/utils/urls.ts (getSiteUrl()), which prefers NEXT_PUBLIC_SITE_URL, falls back to NEXT_PUBLIC_APP_URL, strips trailing slashes, and only then falls back to the production domain. Two problems with the hardcoded version: copying a link while developing on localhost:3000 gives you a production URL, and the canonical site is www.agentpostmortem.com while the button emits the apex domain.
What to do
- Import
getSiteUrl from @/lib/utils/urls in components/post/CopyLinkButton.tsx.
- Use it to build the copied URL:
${getSiteUrl()}/case/${caseNumber}.
- Check whether any other component hardcodes
https://agentpostmortem.com in client code and fix those the same way (grep -rn "https://agentpostmortem.com" components app). Leave the intentional default inside lib/utils/urls.ts alone.
Verify
npm run lint
npx tsc --noEmit
npm run format
npm test
Then run npm run dev, open any case page, click Copy Link, and confirm the pasted URL points at your local origin.
The "Copy Link" button on a case page builds the copied URL from a hardcoded string:
components/post/CopyLinkButton.tsxThe repo already has a helper for this in
lib/utils/urls.ts(getSiteUrl()), which prefersNEXT_PUBLIC_SITE_URL, falls back toNEXT_PUBLIC_APP_URL, strips trailing slashes, and only then falls back to the production domain. Two problems with the hardcoded version: copying a link while developing onlocalhost:3000gives you a production URL, and the canonical site iswww.agentpostmortem.comwhile the button emits the apex domain.What to do
getSiteUrlfrom@/lib/utils/urlsincomponents/post/CopyLinkButton.tsx.${getSiteUrl()}/case/${caseNumber}.https://agentpostmortem.comin client code and fix those the same way (grep -rn "https://agentpostmortem.com" components app). Leave the intentional default insidelib/utils/urls.tsalone.Verify
npm run lint npx tsc --noEmit npm run format npm testThen run
npm run dev, open any case page, click Copy Link, and confirm the pasted URL points at your local origin.