A proof of concept for a blog using Next.js and the new Notion API. ✨
How it works:
- Blog posts are stored as Notion pages in a database (full page table).
- A Notion integration generates a token to authorize access to the database.
- A client is initialized using the Notion SDK.
- For this specific example, only pages marked as
published
in the table properties are fetched using the API's filter param.
-
getStaticProps()
uses incremental static regeneration to update pages in the background (more info).
- Dynamic pages are generated using Notion's page ids.
Considerations:
- The Notion API currently only supports text blocks and these need to be fetched separetely from pages.
- Text blocks are returned as strings and need to be styled with CSS to recreate the rich text format.
- Currently there is no support for custom post URLs as you can only query posts by id.
To dos: