使用Notion作为博客数据后端

使用Next.js的静态站点生成器功能搭建一个Notion为后端的博客。新版的已经改成使用Notion api beta了,大家不要看这个了。

1.下载源码

https://github.com/goooice/notion-blog

2.打开Notion新建Page,改名为Blog

3.插入inline table并添加列

shell
Page
Slug
Published
Date
Authors
An image from Notion

4.获取BLOG_INDEX_ID

An image from Notion

5.打开https://www.notion.so/ ,登陆并获取NOTION_TOKEN。

An image from Notion

6.在源码根目录将.env文件复制为.env.local,并将NOTION_TOKEN与BLOG_INDEX_ID对应写入。

7.docker编译

shell
docker build . -t 

8.运行容器

shell
docker run -p 3000:3000 --env-file .env.local my-next-js-app

9.发布到自己的服务器

An image from Notion