type
status
date
slug
summary
tags
category
icon
password
Property
Mar 9, 2023 07:16 AM
背景
本人作为 Notion 的重度使用者,平时做各种笔记用习惯了 Notion,对 Notion 的各方面都比较熟悉,想要将记录在 Notion 的笔记直接发布到博客中,所以在众多博客网站建设的方案中选用此方案
方案优势
- 易上手 -》发布时,在Notion 中写好并设置之后也不需要额外操作,其余方案还需要手动部署,操作门槛会高些
- 所见即所得 -》不用自己去管如何设置样式,Notion 中提供的丰富的样式,满足绝大多数使用场景
- 其余搭建博客方案参考
前置条件
- 最好了解并学习过 Notion 的使用 -》Notion 介绍博文 、NotionChina【Notion 使用指南】
- 准备一个域名(如果你想通过域名访问自己的博客网站)-》可以网上搜索如何购买域名,域名提供商很多,本人使用的是阿里云的域名服务,应该有更好、更便宜的域名提供商【阿里云、腾讯云、华为云、Namesilo、Godaddy、Cloudflare 等】,小白建议在中国厂商购买,这样操作门槛应该比较低
最佳实践
使用方案
个性化操作
- 只需修改 blog.config.js 中的配置宏,修改完成后使用 Git 提交到 GitHub
![notion image](https://www.notion.so/image/https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fsecure.notion-static.com%2F86f1e258-cf4b-4b59-9851-1714c4023185%2FUntitled.png?table=block&id=813f4b35-1857-401a-af52-151ff287148d)
- git push 到 GitHub 后 vercel 会自动进行部署,以更新网页
![notion image](https://www.notion.so/image/https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fsecure.notion-static.com%2F15986ad6-bed2-43fb-809f-35f93c914eeb%2FUntitled.png?table=block&id=822e579e-4e63-49ff-8314-514527a6f616)
修改网页标签栏
- 标签栏 ICON 替换 -》public 文件夹下的 favicon.ico 或 favicon.svg 替换为自定义图片即可
![notion image](https://www.notion.so/image/https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fsecure.notion-static.com%2F2f8a4719-ec22-4686-a2f2-fa17a41d6d96%2FUntitled.png?table=block&id=3f6b8262-657e-455e-acf3-87e35eb6c5b2)
- Notion 主页中修改作者头像、网页标题、网页简介
![notion image](https://www.notion.so/image/https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fsecure.notion-static.com%2Fd3e42124-edd9-4c8f-97fb-720afc31adf9%2FUntitled.png?table=block&id=deadfcfb-ba3c-41a4-abe2-a9b7d3fb0af0)
- 效果展示
![notion image](https://www.notion.so/image/https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fsecure.notion-static.com%2F51aba747-3dd0-4203-8467-90fe6d001ba5%2FUntitled.png?table=block&id=74901a1b-0d31-4b32-a430-7e060496968c)
![notion image](https://www.notion.so/image/https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fsecure.notion-static.com%2Fb8d53df5-a86e-4b6e-bcb2-a56ef2f59790%2FUntitled.jpeg?table=block&id=4bd7e1f3-702f-4a79-b250-a475dc7a0841)
更改导航栏中的图标
- 在 Notion 的目录中的 icon 栏修改相应文章的图标标识,格式
fas xxxx
,其中 xxx 是在 fontawesome 网站中寻找到的对应的图标样式 - 以 GitHub 为例,填入红框内容代替上述 xxxx 文本即可
![notion image](https://www.notion.so/image/https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fsecure.notion-static.com%2F82658ccd-a8f0-4dc5-b1e4-fbeeccfbe072%2FUntitled.png?table=block&id=c3f9aa93-3910-4642-b320-96df8b3bef10)
![notion image](https://www.notion.so/image/https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fsecure.notion-static.com%2F9ec7b3b5-b090-4078-b587-1fbdf15e483a%2FUntitled.png?table=block&id=06879c2b-f8e2-4ef2-8046-8648bd71cc97)
设置文章预览时显示的图片
- 用 Notion 写文章时,最上方标题的上面可以 Add cover 和 Change cover,添加的 cover 即为预览时的背景图
![notion image](https://www.notion.so/image/https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fsecure.notion-static.com%2F0344f1d7-923a-409a-9116-63e0990408aa%2FUntitled.png?table=block&id=d475e9e1-2b73-4e11-a4db-b5e88db8befd)
添加评论系统
- NotionNext 配置 Valine/Waline 评论插件(本人采用的方案,选一种方案即可)-》此文档有些步骤可能有疑问,详细内容建议参考下面的官方文档中的快速上手
- 注意最好选用国际版 LeanCloud,国内版需要按照 Waline 官方文档 完成备案接入步骤
![notion image](https://www.notion.so/image/https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fsecure.notion-static.com%2Fd2b335d9-a19a-4a98-999e-b8f874a65295%2FUntitled.png?table=block&id=d31c0efb-3bce-4419-92ea-5817ad40bf2c)
- 遇到的问题:
- 按以上步骤操作后,还需在 blog.config.js 配置文件中将如下环境变量设置为上面在 vercel 中配置好的域名,第二个环境变量设为 false 是关闭最新评论,因为本人尝试过却一直加载不出最新评论,可按需设置
![notion image](https://www.notion.so/image/https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fsecure.notion-static.com%2F42c7b0d1-fe1a-4fbb-9b0c-7f462153753c%2FUntitled.png?table=block&id=0c2a3f2a-1624-449a-9086-2d37dd5ec126)
![notion image](https://www.notion.so/image/https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fsecure.notion-static.com%2F168c1224-85fa-40e6-a7af-36ba3b78f036%2FUntitled.png?table=block&id=e6c6a8cd-e229-4811-ada0-c38af7eea5fd)
- 评论管理方式(2种)
- 后台管理(后台 url 为 xxx/ui,其中 xxx 为配置的 waline 域名)
- 评论区登录后直接进行管理
![notion image](https://www.notion.so/image/https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fsecure.notion-static.com%2Fcdc32eef-2499-43f5-b577-96e76dc69b54%2FUntitled.png?table=block&id=2d8e7171-5bb5-4a6f-bf29-ad6112856cc6)
![notion image](https://www.notion.so/image/https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fsecure.notion-static.com%2F89e113f6-aa07-4028-b464-6baca8ddc743%2FUntitled.png?table=block&id=acc71415-5b00-4399-ab21-c2a1d5c50b45)
遇到的一些问题
【没有遇到可忽略】
Q:通过域名访问会跳过起始页,直接来到主页
- 该页面未显示
![notion image](https://www.notion.so/image/https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fsecure.notion-static.com%2Fbdda8c7f-ba0f-4f17-8006-90d12a66c913%2FUntitled.png?table=block&id=2e6bd478-734b-4fac-97f5-eddb5b80d3d9)
- 输入域名后直接显示的页面如下
![notion image](https://www.notion.so/image/https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fsecure.notion-static.com%2Fac9f0b24-73f9-4e34-9eb3-53e859171388%2FUntitled.png?table=block&id=d2306e1b-4381-4b90-84a1-e6c04b1f11f5)
- DO:
以上问题应该是重定向造成的,在 vercel 的域名配置中,不要按照推荐方法设置,进行类似如下的设置即可
![notion image](https://www.notion.so/image/https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fsecure.notion-static.com%2Fffdbc888-ce6e-4188-aed5-34ef975342ec%2FUntitled.png?table=block&id=26fd6559-8c08-4452-83da-31ca839a9e26)
Q:如何自定义 Live2d 挂件
- DO:
- 在 blog.config.js 修改宏为 ture 或者 false 进行开启或关闭
![notion image](https://www.notion.so/image/https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fsecure.notion-static.com%2F3d96bf92-2ec9-4667-8545-356775b91183%2FUntitled.png?table=block&id=495fcb3d-c366-4f91-a43f-ae1e44849460)
- 更换挂件
- 挂件列表-》在 ReadMe 中列出
- 选取挂件末尾的名字进行替换-》替换宏中 url 的两处即可
- 缺点:预览链接失效,无法看到更换的挂件样子,得部署后才看得到效果
![notion image](https://www.notion.so/image/https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fsecure.notion-static.com%2F33eedc18-0631-4326-9b6e-394f53a6e368%2FUntitled.png?table=block&id=ba8a8742-d0cc-41d5-a3da-80f9f2b8a8f1)
![notion image](https://www.notion.so/image/https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fsecure.notion-static.com%2F27c5d34b-37c8-40ca-81e2-cc9c83fa90de%2FUntitled.png?table=block&id=2f176a19-1f65-4ef2-bc21-eb8386c1a6b0)
- git push 到 GitHub 后 vercel 会自动进行部署,以更新网页
![notion image](https://www.notion.so/image/https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fsecure.notion-static.com%2F8d057138-27a0-42e5-9a9c-b142a809659c%2FUntitled.png?table=block&id=175da22c-2da8-4722-a184-1708e28630f9)
Q:如何让自己的网站被搜索引擎搜寻到?
- 将自己的网站域名提交给各大搜索引擎,以更好的被搜索引擎发现 -》提交入口
Q:如何修改引导语和背景色
- 作者在官方 Issues 中回答了此问题 -》点此查看
- 作者:OctalZero
- 链接:https://octalzero.com/article/a544588f-e488-48a1-8ae5-3c5f46841e0f
- 声明:本文采用 CC BY-NC-SA 4.0 许可协议,转载请注明出处。