Open
Description
In a Notion page, if you link to another page also in Notion, the linked page will be rendered as:
<a href="/1a2b3c4d">...</a>
where 1a2b3c4d
is the id of the linked Notion page.
If you use pretty URLs, then how to you map the link above to the pretty URL?
I haven't tested out this idea, but it seems I'll need to:
- In
onCreateNode
, create newslug
field for each node. - In
onCreatePage
, query themarkdownString
value of the page. - Search for any instance of relative URL, then query the Notion node with this id, then get the
slug
value of that node. - Create a new string based on
markdownString
, replacing the original relative URL with the new one that includes pretty url. - Pass the new string as context to
createPage
. - This `context prop can then be access in the template component.
Can anyone offer any guidance?
Metadata
Metadata
Assignees
Labels
No labels