Skip to content

Fix pretty slug pages rendering root content (#90)#93

Merged
shigahi merged 1 commit intomasterfrom
fix/slug-blockid-injection
Apr 20, 2026
Merged

Fix pretty slug pages rendering root content (#90)#93
shigahi merged 1 commit intomasterfrom
fix/slug-blockid-injection

Conversation

@shigahi
Copy link
Copy Markdown
Collaborator

@shigahi shigahi commented Apr 20, 2026

Summary

  • Fixes Pretty links resolving to root #90: pretty slug URLs (e.g. /about, /journal) rendered the root page's content instead of their own page.
  • Root cause: the /api/v3/getPublicPageData handler (added in a759056) force-injected the root page's blockId whenever the client omitted it. The client omits blockId for any URL without a 32-hex page ID — root / and every pretty slug — so all slug pages resolved to the root page.
  • Now the Worker resolves the current page from the Referer header: look up SLUG_TO_PAGE[slug], fall back to a 32-hex match in the path, and only use the root page when nothing else matches.

Test plan

  • npm run build succeeds
  • Deploy to a test Worker with at least one slug (e.g. /about) mapped to a non-root Notion page and verify:
    • Direct visit to /about renders the /about page content (not root)
    • Root / still renders the root page
    • Direct visit to /<32-hex-pageId> still resolves correctly
  • Ask issue reporter (@bflack) to regenerate the Worker script and confirm woven.press/about and woven.press/journal work

The getPublicPageData handler was force-injecting the root page's
blockId whenever the client omitted it. The client omits blockId for
every URL without a 32-hex page ID, including pretty slug URLs like
/about, so all slug pages rendered the root page.

Resolve the current page from the Referer header: map the referring
path to a slug in SLUG_TO_PAGE, fall back to a 32-hex match, and only
use the root page when nothing else matches.
@shigahi shigahi merged commit 7b79d3e into master Apr 20, 2026
5 checks passed
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.

Pretty links resolving to root

1 participant