A Next.js site using new SSG support with a Notion backed blog
This is an example Next.js project that shows Next.js' upcoming SSG (static-site generation) support using Notion's private API for a backend.
Note: This example uses the experimental SSG hooks only available in the Next.js canary branch! The APIs used within this example will change over time. Since it is using a private API and experimental features, use at your own risk as these things could change at any moment.
Live Example hosted on Vercel: https://notion-blog.vercel.app/
To view the steps to setup Notion to work with this example view the post at https://notion-blog.vercel.app/blog/my-first-post or follow the steps below.
Deploy your own Notion blog with Vercel.
or
git clone https://github.com/ijjk/notion-blog.git
vc
NOTION_TOKEN
BLOG_INDEX_ID
vc
Note: if redeploying with
vc
vc -f
Note: this is auto run if a table isn't detected the first time visiting
/blog
git clone https://github.com/ijjk/notion-blog.git
cd notion-blog && yarn
NOTION_TOKEN='token' BLOG_INDEX_ID='new-page-id' node scripts/create-table.js
The table should have the following properties:
Page
Slug
/blog
Published
Date
Authors
To get your blog index value, open Notion and Navigate to the Notion page with the table you created above. While on this page you should be able to get the page id from either:
BLOG_INDEX_ID
S5qv1QbU-zM1w-xm3H-3SZR-Qkupi7XjXTul
loadPageChunk
loadPageChunk
pageId
BLOG_INDEX_ID
To get your Notion token, open Notion and look for the
token_v2
To run the project locally you need to follow steps 1 and 2 of deploying and then follow the below steps
yarn
NOTION_TOKEN
BLOG_INDEX_ID
export NOTION_TOKEN='<your-token>'
export BLOG_INDEX_ID='<your-blog-index-id>'
set NOTION_TOKEN="<your-token>" && set BLOG_INDEX_ID="<your-blog-index-id>"
yarn dev
yarn build && yarn start
A Next.js site using new SSG support with a Notion backed blog
This is an example Next.js project that shows Next.js' upcoming SSG (static-site generation) support using Notion's private API for a backend.
Note: This example uses the experimental SSG hooks only available in the Next.js canary branch! The APIs used within this example will change over time. Since it is using a private API and experimental features, use at your own risk as these things could change at any moment.
Live Example hosted on Vercel: https://notion-blog.vercel.app/
To view the steps to setup Notion to work with this example view the post at https://notion-blog.vercel.app/blog/my-first-post or follow the steps below.
Deploy your own Notion blog with Vercel.
or
git clone https://github.com/ijjk/notion-blog.git
vc
NOTION_TOKEN
BLOG_INDEX_ID
vc
Note: if redeploying with
vc
vc -f
Note: this is auto run if a table isn't detected the first time visiting
/blog
git clone https://github.com/ijjk/notion-blog.git
cd notion-blog && yarn
NOTION_TOKEN='token' BLOG_INDEX_ID='new-page-id' node scripts/create-table.js
The table should have the following properties:
Page
Slug
/blog
Published
Date
Authors
To get your blog index value, open Notion and Navigate to the Notion page with the table you created above. While on this page you should be able to get the page id from either:
BLOG_INDEX_ID
S5qv1QbU-zM1w-xm3H-3SZR-Qkupi7XjXTul
loadPageChunk
loadPageChunk
pageId
BLOG_INDEX_ID
To get your Notion token, open Notion and look for the
token_v2
To run the project locally you need to follow steps 1 and 2 of deploying and then follow the below steps
yarn
NOTION_TOKEN
BLOG_INDEX_ID
export NOTION_TOKEN='<your-token>'
export BLOG_INDEX_ID='<your-blog-index-id>'
set NOTION_TOKEN="<your-token>" && set BLOG_INDEX_ID="<your-blog-index-id>"
yarn dev
yarn build && yarn start