Bookmark ID redirects after Notion renames
Problem
Pattern public URLs are title-derived (/patterns/229-top-banner-…). Saved bookmarks stored that slug. Renaming Notion titles (e.g. adding brands) regenerates the slug at build time, so old library links 404’d even though the Notion page id never changed.
Example: /patterns/229-top-banner-for-design-changes → /patterns/229-top-banner-for-design-changes-google-meet.
Fix (free-tier safe)
Shipped on the client + existing CDN _redirects only. No widening of the Netlify edge redirector to /patterns/* (that would bill an edge invocation on every pattern pageview).
- Stable identity — bookmarks already store Notion
pattern_id. Normalize to dashless hex everywhere (local + cloud). - Navigate by id — drawer / library links use
/patterns/{notionId}. Netlify_redirectsalready maps folder + Notion id → current canonical slug (regenerated each build). - Refresh metadata — on library/drawer load, merge title/slug/cover/tags from
search-index.jsonby id so UI shows current names.
Deferred (higher free-tier cost)
- Edge
patternNumberMap+ serving the redirector on/patterns/*to repair shared/external stale title-slugs server-side.
Soft repair for shared/old title URLs (no edge)
StalePatternRedirect on the 404 page reads the pattern number from /patterns/{n}-…, looks up a unique match in search-index.json, and location.replaces to the current slug. Client-only — no edge invocations.
Key files
src/lib/bookmarks.ts—getBookmarkHref,mergeBookmarksWithIndex, id normalizationsrc/components/BookmarkDrawer.tsx,LibraryFlowView.tsx,BookmarkButton.tsx,src/app/library/page.tsxsrc/lib/bookmark-cloud.ts— dashlesspattern_id- Existing
scripts/build-redirects.mjsNotion-id rules (unchanged)