如何使用 notion 搭建个人博客
type
status
date
slug
summary
tags
category
icon
password
引子
之前一直使用 github.io 配合 hexo 搭建得个人博客,但是每次更新需要使用命令行,太麻烦。
看到朋友使用 notion 搭建了个人主页,很漂亮,更新维护也很方便,所以起了将个人域名绑定到 notion 上得想法,一搜,果然已经有了成熟得付费方案,并且已经有免费开源方案可用,赶紧动手!
调研
一番调研,发现免费方案 fruition 很合自己胃口,遂 google 几个博主得文章,具体流程如下:
- 购买域名(此处不介绍)
- 使用(
白嫖) cloudfare 管理个人域名得 dns
- 公开分享 notion 页面,获取分享链接
- 使用 cloudfare 得 worker 工具重定向 notion 分享链接(不确定重定向理解得是否正确)
流程
1. 购买域名
网上有太多方法了,比如国内可以在腾讯云、阿里云购买
国外网站有 godaddy,太多了,不赘述
2. 使用 cloudfare 管理域名 dns
2.1 添加站点



2.2 查看 DNS 记录

在这一步,cloudfare 会解析出当前域名得 dns 记录,不用管,继续点击下一步

2.3 更改域名 DNS
接下来以阿里云修改域名 DNS 作为介绍

点击管理,进入修改 dns 页面

点击修改 DNS 按钮

更改后过段时间 cloudfare 就会更新页面,表明正在使用 cloudfare 得 dns 服务

3. 获取 notion 分享链接
这个太简单了,大家自行搜索
4. 更改 cloudfare worker 设置
4.1 新建 worker
在首页点击「Workers and Pages」,然后点击「创建 worker」

名称随便填,我用的是「notion」,然后点击部署

4.2 获取 worker 代码
在
Your Domain
中输入你得域名在
Notion URL
中输入你得 notion 页面分享链接点击
COPY THE CODE
按钮,获取 js 代码4.3 更新 worker 代码
点击进入 notion worker 得代码编辑页


清空所有代码,然后粘贴上面复制得代码,最后点击「保存并部署」

4.4 更新路由

按照如下内容填写并保存
路由为你的域名+/*,例如
xxxxxx.com/*
Worker 选择你刚创建得那个,例如
notion
环境没得选,只有
production

至此,大功告成!
FAQs
万一你按照我的流程仍然没有成功,请执行这一步操作

需要填写内容如下:
- 域名得 URL
- 选择转发 URL
- 选择 301-永久重定向
- 输入 notion 页面得分享链接

保存页面规则后,就能正常通过域名访问了!还不行,请出门左拐问 google 哈
参考
Loading...