Docs menu
Guides
Linking pages
Point links between Notion pages to your own routes.
Notion content links to other Notion pages in three ways: page mentions and links inside text, link to page blocks, and child pages. All of them go through one function, pageHref.
TypeScript
<NotionRenderer blocks={blocks} pageHref={(pageId) => routes.get(pageId) ?? null}/>pageIdis 32 lowercase hex characters, without dashes.- Return a URL or path to link there, or
nullto show the text without a link, for example for pages that aren't published. - By default, links point to the page on notion.so (opens in a new tab), which works for pages shared to the web.
These docs map each Notion page to its /docs/<slug> route, so links between docs pages stay on this site.
Links to other sites open in a new tab, with a screen reader hint. #anchors, paths, mailto: and tel: links stay in the tab. Unsafe links, such as javascript:, render as plain text.