一个纯中文的静态个人博客,零依赖、零成本,托管在 GitHub Pages 上。
site/
├── index.html 首页(文章列表)
├── about.html 关于
├── friends.html 友情链接
├── contact.html 联系(留言表单)
├── thanks.html 留言成功后的页面
├── 发布.bat 双击即可推送上线
├── css/style.css 全部样式
├── js/main.js 菜单 / 主题切换
└── posts/
├── _template.html 文章模板(复制它来写新文章)
└── 随思.html 你的文章
最简单的方式:直接双击 index.html,用浏览器打开即可。
如果页面里的主题切换、菜单等交互看起来没反应,多半是浏览器限制了本地 JS,可以起一个本地服务:
python -m http.server 8000然后浏览器访问 http://localhost:8000 。
把下面几处文字里的「大橘的博客」替换成你想要的名字:
- 每个
.html文件的<title>标签 - 头部左上角的
<a class="site-title">大橘的博客</a> - 每个页面页脚的版权文字
- 复制
posts/_template.html,重命名为posts/标题.html(例如posts/随思.html)。 - 用文本编辑器打开,替换:
<title>和<h1>里的「文章标题」<time datetime="...">和显示日期<div class="post-body">和</div>之间的正文
- 正文直接写字即可:回车 = 换行,空一行 = 新段落,不用管 HTML 标签。
- 打开
index.html,在<ul class="post-list">里新增一条,指向你的新文章:
<li>
<a class="post-link" href="posts/随思.html">
<span class="post-title">随思</span>
<time class="post-date">2026-08-24</time>
</a>
</li>改完之后,双击根目录里的 发布.bat,它会自动提交并推送到 GitHub,一两分钟后网站就更新了。
如果你想自己敲命令,等价的三条命令是:
git add .
git commit -m "更新内容"
git push联系表单用的是 FormSubmit(免费,无需注册)。你只需要做一件事:
- 打开
contact.html; - 把
action="https://formsubmit.co/yourname@example.com"里的yourname@example.com换成你自己的邮箱; - 顺带把页面里
mailto:后面的邮箱也一起换了。
第一次有人提交留言后,FormSubmit 会往这个邮箱发一封确认邮件,点一下激活即可。之后留言就会直接发到你的邮箱。
打开 friends.html,在 <ul class="friend-list"> 里新增一条:
<li class="friend-item">
<a href="https://对方的网址" target="_blank" rel="noopener">
<span class="friend-name">对方的名字</span>
<span class="friend-desc">一句话介绍</span>
</a>
</li>网站是纯静态文件,部署只需要:装 git → 建仓库 → 推送 → 开启 Pages。
电脑上已有 conda,可以用它装 git:
conda install -c conda-forge git装完后配置身份(只需一次):
git config --global user.name "你的名字"
git config --global user.email "你的邮箱"- 注册 / 登录 github.com;
- 右上角
+→New repository; - 仓库名填
你的用户名.github.io(注意这个格式),选 Public,不要勾选任何初始化选项,点创建。
在本目录打开 PowerShell,执行:
git init
git add .
git commit -m "第一次上线"
git branch -M main
git remote add origin https://github.com/你的用户名/你的用户名.github.io.git
git push -u origin main- 进入仓库 →
Settings→Pages; Source选择Deploy from a branch,分支选main,目录选/ (root),保存;- 等一两分钟,你的网站就会出现在
https://你的用户名.github.io。
之后每次改动,直接双击 发布.bat 即可(等价于 git add . + git commit + git push)。
- 评论区:可以用 Giscus(基于 GitHub Discussions,免费)
- 后台管理:以后想不写代码也能发文章,可以考虑迁到 WordPress / Ghost / Halo
- 自定义域名:在域名注册商处买域名后,到 Pages 设置里绑定即可
- 站点图标(favicon)、更多页面、图片等