Update 2025年8月 “add-cms-system”
This commit is contained in:
@@ -14,14 +14,21 @@ comments: true
|
||||
# 序言
|
||||
|
||||
因为喜欢wordpress之类动态博客的在线编辑功能,但是又不想抛弃hexo,特别是这个花里胡哨的模板,所以想着给博客添加一个cms系统,在搜索一番后发现这种CMS系统叫无头CMS,然后找到一个很好的系统:sveltia-cms
|
||||
|
||||
|
||||
{% sveltia-cms,sveltia,https://github.com/sveltia/sveltia-cms %}
|
||||
|
||||
# 安装
|
||||
|
||||
## 安装包
|
||||
|
||||
在博客根目录下运行`npm i @sveltia/cms`
|
||||
|
||||
## 创建必要文件
|
||||
|
||||
然后在博客`source`目录下创建`admin`目录
|
||||
并在其下新建`index.html`
|
||||
|
||||
```html
|
||||
<!doctype html>
|
||||
<html>
|
||||
@@ -36,7 +43,9 @@ comments: true
|
||||
</body>
|
||||
</html>
|
||||
```
|
||||
|
||||
新建`config.yml`
|
||||
|
||||
```yml
|
||||
# https://decapcms.org/docs/configuration-options/
|
||||
backend:
|
||||
@@ -177,9 +186,12 @@ collections:
|
||||
preview_path: "about/"
|
||||
<<: *common_col_conf
|
||||
```
|
||||
|
||||
需要自己修改一些配置;
|
||||
一般到这一步就可以了,但是因为我使用自己的服务器,没办法用官方的auth系统,所以还要进一步配置。
|
||||
|
||||
## 创建auth系统、授权
|
||||
|
||||
{% Sveltia CMS Authenticator,Sveltia CMS Authenticator,https://github.com/sveltia/sveltia-cms-auth%}
|
||||
比较简单,直接Cloudflare一键部署就可以
|
||||
然后要在github新建一个oauth应用,就不写了,可以自己查找。
|
||||
@@ -187,6 +199,7 @@ collections:
|
||||
`GITHUB_CLIENT_ID`:
|
||||
`GITHUB_CLIENT_SECRET`:
|
||||
然后在`config.yml`添加
|
||||
|
||||
```yml
|
||||
backend:
|
||||
name: github # or gitlab
|
||||
@@ -194,7 +207,9 @@ collections:
|
||||
branch: main
|
||||
base_url: <YOUR_WORKER_URL>
|
||||
```
|
||||
|
||||
# 大功告成
|
||||
|
||||
访问博客的admin就可以了
|
||||
这是编辑页面
|
||||
<center><img src="https://pic.biss.click/i/2025/08/26/085014.webp" alt="085014.webp"></center>
|
||||
|
||||
Reference in New Issue
Block a user