因为我的 Hexo 博客是拉取我在语雀上的文章还有本地写的文章,所以没有直接采用相关的 Notion 部署成 Blog 的已有 API。
还是使用将文章拉取到本地再手动部署的方式。
参考:yuque-hexo
为 Notion API 设置访问令牌
需要设置一个 Integration(集成),通过 Notion API 连接访问自己的数据库,然后生成一个访问令牌来访问 Notion 的 API。
在Notion API 文档页面,点击右上角的View my integrations 链接。点击+ New integration按钮。

创建集成完毕后,将会在详情页看到自己的访问令牌:

在 Notion 内创建你的博客表格

我创建了一个 Blog 表格,并为每个文章设置了title,slug(urlname),tags,categories,description,publish,created_at和updated_at这几个字断。
其中slug是直接截取了 id 的一部分作为 url name:

在 blog 项目内配置相关信息
点击 Blog 页面右上角的···按钮,在Connections内选择我们刚刚创建的my-blog集成。
事先拥有一个 hexo项目,并在 package.json中配置相关信息:
"notionConfig": {
"mdNameFormat": "slug",
"baseUrl": "https://api.notion.com/v1/databases/",
"token": "your Internal Integration Token",
"database": "your database id",
"postPath": "source/_posts/notion" // markdown所在文件
},
太久了,快要忘记内容了,等下次重新看下再继续。