Notion文章自动同步GitPage
type
status
date
slug
summary
tags
category
icon
password
契机NotionNext搭建官方文档拷贝模板分享到站外并且复制自己的pageIdfork大佬的项目到自己GitHub上运行测试&打包仓库文件添加部署到GitPage美化更换标题自定义美化自动化脚本编写目录结构deploy脚本DokcerFile文件准备容器内GitPage推送权限搭建步骤验证特别提醒写到最后
契机
Notion GitPage docker 自动化整合
之前一直使用GitPage+typora+hexo来做文章分享管理,奈何真的麻烦坚持不下去了。
Notion是我一直在使用的笔记软件,为了更好的使用Notion我还去看了许多文章。现在Notion已经是我生活的一部分了
最近发现NotionNext,但需要Vercel部署,还需要自己映射域名
所以想着用xx.github.io域名,优雅又方便
NotionNext搭建
官方文档
拷贝模板

分享到站外并且复制自己的pageId

假如:pageId=12345
fork大佬的项目到自己GitHub上
运行测试&打包
仓库文件添加
部署到GitPage

美化
更换标题
打开自己的notion页面,找到配置中心,把要自定义的全改了

打开notionNext工程目录,找到blog.config.js,把想改的全改了

自定义美化
我选择的是gitbook主题,年纪大了现在喜欢性冷淡风格的
默认启动头像是height=28px,拉伸变形了,修改global.css

默认进来显示归档页面,注释gitbook主题下index.js部分代码,再修改config.js进来显示归档


归档,分类,标签页面显示头像,同样修改gitbook主题下index.js部分代码

自动化脚本编写
思路:sh脚本编写以上命令,termilal自动运行脚本容易误杀,想着用docker容器,因为我电脑只要开着,docker一定在线。容器启动就自动运行这个脚本,容器挂载NotionNext和GitPage仓库,这样修改起来方便,如果有云服务器迁移也方便。 还有每次export之前记住移除rm ./NotionNext/public/sitemap.xml这个文件
目录结构

deploy脚本
DokcerFile文件
准备容器内GitPage推送权限
去这个页面选择创建新的token
勾选如下

再执行下面的命令,这样容器中就可以随意push到GitPage了
搭建步骤
验证

特别提醒
- 自己notion的PageId最好不要对外暴露,因为文章是支持密码访问的
- fork下来的NotionNext最好改成私有,避免泄漏关键信息
- 在github仓库中提前建好.nojekyll文件
- 每次export的时候要删除./NotionNext/public/sitemap.xml
写到最后
Last update: 2024-01-19