This is an example of a Next.js site that uses the new Next.js file system router to create a blog site that is powered by the Notion Public API.
Live example hosted on Vercel: https://neonblog.vercel.app/
To get started, you need to follow these steps:
-
Create a new blank Notion page
-
Add inline table on your page
-
Add the below fields to your table
title
: This is the title of your blog postslug
: This is the slug of your blog post,it should be a text propertyauthor
: This is the author of your blog post, it should be a person propertybanner
: This is the banner of your blog post, it should be a file propertybannerImageHeight
: This is the height of your banner image, it should be a number propertybannerImageWidth
: This is the width of your banner image, it should be a number propertycreated_at
: This is the created date of your blog post, it should be a date propertyexcerpt
: This is the excerpt of your blog post, it should be a text propertyhighlight
: This is checkbox to highlight your blog post, it should be a checkbox propertystatus
: This is the status of your blog post, it should be a status property with options:draft
andpublished
tags
: This is the tags of your blog post, it should be a multi-select propertyupdated_at
: This is the updated date of your blog post, it should be a date property
To get your Notion Blog ID and Token, you need to follow Notion's Getting Started Guide. Then, you need to add your NOTION_SECRET
and NOTION_DATABASE_ID
to your .env.local
file.
- Create a new row in your database in Notion
- Add a title, banner, bannerImageHeight, bannerImageWidth, tags, and content
- Fill slug with the same value as the title, but in lowercase and with dashes instead of spaces
- Fill excerpt with a short description of the post
- Fill checkbox highlight with true if you want to highlight the post
- Fill status with published if you want to publish the post
- Repeat!
-
Clone this repo
git clone https://github.com/Ikram-Maulana/neon-blog.git
-
Install dependencies
pnpm install
-
Add your
NOTION_SECRET
andNOTION_DATABASE_ID
to your.env.local
fileNOTION_SECRET=... NOTION_DATABASE_ID=...
-
Run the development server
pnpm dev
-
Open http://localhost:3000 with your browser to see the result.
- Add Search Functionality
- Add Query Posts by Tag
- Add Query Posts by User
-
Clone this repo
git clone https://github.com/Ikram-Maulana/neon-blog.git
-
Configure project with Vercel
-
Add your
NOTION_SECRET
andNOTION_DATABASE_ID
to your Vercel Project Environment Variables -
Do final deploy with Vercel