开源的文章管理器—PagesCMS

490 字
2 分钟
开源的文章管理器—PagesCMS

PagesCMS原理与使用教程)#

Pages CMS 是一个轻量级、基于 Git(Git-based) 的开源无头内容管理系统(Headless CMS)。它没有传统的独立数据库,而是直接把你的 GitHub 仓库 作为数据源。


一、 Pages CMS 的底层工作原理#

Pages CMS 的核心逻辑可以总结为:

可视化界面 → GitHub API → 触发 Git Commit → 自动构建部署

[ 用户在 Pages CMS 后台操作 ]
│
▼ (通过 GitHub OAuth 授权)
[ Pages CMS 调用 GitHub API ]
│
▼ (在你的仓库进行文件读写)
[ 仓库 src/content/posts/ 产生变动 (Commit) ]
│
▼ (Webhooks 自动触发)
[ Vercel / Cloudflare Pages / GitHub Pages ]
│
▼ (执行 astro build)

二、 使用教程#

Step 1. 准备配置文件#

访问你的 GitHub 博客仓库,在仓库根目录下创建一个新文件,命名为 .pages.yml。

Step 2. 连接并配置后台#

  1. 访问 Pages CMS 官网,使用 GitHub 账号登录。
  2. 登录后选择你的博客仓库。
  3. 首次使用需要配置:点击左侧导航栏的 Configuration 选项卡,输入以下 YAML 配置代码并保存
content:
- name: posts
label: 文章列表
type: collection
path: src/content/posts
filename: "{slug}.md"
view:
fields: [title, published, category, sticky, draft] # 在后台列表中加上 sticky 列,方便一眼看到置顶状态
search: [title, description, tags, category]
sort: [published]
order: desc
fields:
- name: title
label: 文章标题
type: string
required: true
- name: published
label: 发布时间
type: date
options:
format: yyyy-MM-dd
required: true
- name: description
label: 文章描述
type: text
- name: image
label: 封面图 (图床 URL)
type: string
- name: tags
label: 标签
type: string
list: true
- name: category
label: 分类
type: string
- name: sticky
label: 是否置顶
type: boolean
default: false # 默认不置顶
- name: draft
label: 是否草稿
type: boolean
default: false
- name: body
label: 文章正文
type: rich-text

保存完成后,你就可以像使用动态博客一样,优雅地在网页端撰写和编辑博客了!

其实你现在看到的这篇博文,就是直接用 PagesCMS 编写并发布的

文章分享

如果这篇文章对你有帮助,欢迎分享给更多人!

开源的文章管理器—PagesCMS
https://xane.eu.cc/posts/pagescms/
作者
xane
发布于
2026-07-22
许可协议
CC BY-NC-SA 4.0

评论区

Profile Image of the Author
xane
Keep going.
统计
公告
搭建成功
音乐
封面

音乐

暂未播放

0:000:00
暂无歌词
分类
标签
站点统计
文章
3
分类
2
标签
6
总字数
1,846
运行时长
0 天
最后活动
0 天前