笔记存在本地,由OpenClaw协助编写。如果再让它驱动 Hugo+GitHub+Cloudflare Pages,就可以再提炼出可分享可公开的博客日志。
搭建步骤 链接到标题
Hugo 初始化 链接到标题
brew install hugo
hugo new site my-blog
cd my-blog
git init
选用 hugo-coder 主题,支持中文,排版干净。
本地写作流程 链接到标题
hugo new content/posts/2026-04-03-my-first-post.md
# 编辑文件,将 draft = true 改为 false
hugo server -D # 本地预览 http://localhost:1313
推送到 GitHub 链接到标题
git remote add origin git@github.com:你的用户名/my-blog.git
git add .
git commit -m "first post"
git push
Cloudflare Pages 接入 链接到标题
- 登录 Cloudflare Dashboard → Workers & Pages → Create application → Pages
- Connect to GitHub,选择仓库
- Build 设置:
- Build command:
hugo - Build output目录:
public
- Build command:
- 绑定自定义域名(如 blog.ohtly.com)
自动化发布 链接到标题
以后只需:
git add .
git commit -m "新文章"
git push
→ 自动触发 Cloudflare Pages 部署 → 1-2 分钟生效。
我的关键配置 链接到标题
hugo.toml 链接到标题
baseURL = 'https://blog.ohtly.com/'
title = 'OHTLY Blog'
theme = "hugo-coder"
defaultContentLanguage = "zh-cn"
languageCode = "zh-CN"
[languages.zh-cn]
languageName = "简体中文"
weight = 1
[params]
dateFormat = "2006年1月2日"
[[menu.main]]
name = "日志"
url = "/posts/"
weight = 1
导航:首页跳转文章列表 链接到标题
layouts/index.html(让首页自动跳转到 /posts/):
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="refresh" content="0;url=/posts/">
<link rel="canonical" href="/posts/">
</head>
<body>
<p>跳转至 <a href="/posts/">日志列表</a>...</p>
</body>
</html>
文章模板(Archetype) 链接到标题
archetypes/default.md:
+++
date = '{{ now |.Format "2006-01-02T15:04:00+08:00" }}'
draft = true
title = '{{ replace .Name "-" " " | title }}'
+++
和 AI 的协作 链接到标题
我的 OpenClaw 跑在 Mac mini 上,Obsidian vault 也由 AI 管理:
- 我说需求 → AI 整理笔记存入 Obsidian
- 值得公开的内容 → AI 生成博客草稿
- 我审阅后 →
git push发布
整个流程:想法 → 笔记 → 博客,完全不依赖手动复制粘贴。
Hugo 是公开版 Obsidian,只放可公开的知识;私密内容留在 vault 里由 AI 管理。