Logo

dev-resources.site

for different kinds of informations.

Building a personal blog with Next.js and Notion

Published at
6/21/2024
Categories
notion
nextjs
cms
seo
Author
khaleo
Categories
4 categories in total
notion
open
nextjs
open
cms
open
seo
open
Author
6 person written this
khaleo
open
Building a personal blog with Next.js and Notion

In this article, we will together build the fastest blog for yourself with Next.js and Notion.

I. Prerequisites

Notion is certainly no stranger to everyone. It is an AI-powered workspace that helps users easily plan, take notes, and integrate with many other applications, making it very convenient.

In terms of the idea, we will use Notion as a CMS to manage post information, and Next.js to display that information for users while leveraging SSR to improve SEO and security.

  • Knowledge of Next.js
  • Personal Notion account

II. Create a database and access token in Notion

  1. Select a page in Notion to store the database.
  2. Add a new element and choose Database - Full page: Add a new element and choose Database
  3. Create the following fields for the database, specifying their type and purpose as follows (these fields are for demo purposes, you can modify them later):

    • Title: Already created as Name, change it to Title
    • Tags (Multi-select): Topic tags
    • Description (Text): Brief description of the post
    • PresentativeMedia (Files & media): To store the featured image for the post
    • Slug (Text): Used as the post's URL
    • Status (Status): Post status, including Draft, Published Create fields for the database
  4. Next, you can access notion-integration to generate a secret token linked to your personal Notion account, which will be used to create the above database. Remember to select only the Read permission: Read content, as shown in the image below:
    notion-integration

  5. After creating the notion-integration, the next step is to allow this integration to access the database. In the Connect to section, choose the integration you just created (I just created for-show-sample), as shown in the image below:
    allow this integration to access the database.

III. Create sample records in database

Based on the created database structure, we will create some sample records as follows. Note that the status of the posts should be changed to Published.

Create sample records

IV. Using notion-nextjs-mini-kit

  1. You can follow the instructions to clone and run the NextJs source code on your machine here.

  2. As per the installation instructions, you will need to replace 2 environment variables.
    NOTION_TOKEN=
    NOTION_DATABASE_ID=

    With:

    • The Notion token is the token generated from Step II.
    • To get the database ID from the database we created, simply open the database page in the browser and copy the string as shown in the image.
  3. Run the NextJs application above and you will see the results as follows

Result

V. Create content for the page

  1. Create content for the pages based on the data created in the previous database.
    Create content for the page

  2. Publish the posts (select share -> publish)
    Publish the posts

  3. Return to our website, click on one of the previous posts to see the results πŸŽ‰
    see the results

VI. Conclusion

References

On this guide, I have shown you how to quickly create a personal blog using NextJs and Notion as a database. If you have any questions or contributions, please leave a comment below. Thank you everyone.

Happy coding! πŸ™ŒπŸ»

notion Article's
30 articles in total
Favicon
Why Most Students Struggle with Organization (And How Notion Templates Can Help)
Favicon
Why Your Notion Templates Aren’t Selling (And How to Fix It)
Favicon
Extract metadata of paper and export it to Notion DB
Favicon
Organize Your Gifts Effortlessly with This Notion Template 🎁
Favicon
Why Most Notion Templates Fail Businesses (And How to Create Ones That Work)
Favicon
Un blog statique sur mesure avec Notion headless
Favicon
Learning GO : 09 - Packages
Favicon
Notion is making a super customizable email app
Favicon
Project Planning
Favicon
Learning GO : 08 - File Handling, Error Handling
Favicon
Learning GO: 07 - Loops
Favicon
Learning GO: 06 - Function return values, if condition
Favicon
Learning GO: 05 - Function Declaration
Favicon
I Analyzed 4 Successful Products to Find These Powerful UI Design and Implementation Principles
Favicon
How I Sync my Obsidian Notes For Free !
Favicon
Best Notion Time Tracking Software
Favicon
Using Notion as a CMS and create a personal blog with React
Favicon
How to Embed Live Reports in Notion Using Flowtrail AI
Favicon
3+ Productivity Hacks with Notion
Favicon
Building a personal blog with Next.js and Notion
Favicon
Notion for NextJS CMS
Favicon
Count everything in your Notion workspace
Favicon
The Best Notion Alternatives in 2024
Favicon
Install Notion on Ubuntu
Favicon
Free Notion Style Avatar Generator
Favicon
Discover Your Notion Page Insights with Notion Statistics
Favicon
Bot Telegram + Notion
Favicon
Building a Notion-style activity feed with Next.js and shadcn/ui
Favicon
I switched from Notion to Obsidian
Favicon
Launch your startup in 450+ communities

Featured ones: