本文记录博客日常维护所需的所有操作。
前提:进入博客目录
所有操作都在本机终端执行,先进入博客目录:
cd /Users/chengzhenbang/Documents/website/einverne.github.io
一、新增文章
1. 创建文件
在 _posts/ 目录下新建 Markdown 文件,文件名格式必须为:
YYYY-MM-DD-文章标题.md
例如:_posts/2026-03-01-my-new-post.md
2. 标准文章格式
---
layout: post
title: "文章标题"
date: 2026-03-01
categories: [随笔]
tags: [标签一, 标签二]
---
正文从这里开始,支持 Markdown 语法。
## 二级标题
这是一段正文。
**加粗文字**,*斜体文字*,[链接文字](https://example.com)
- 列表项一
- 列表项二
> 这是引用块
```python
# 代码块示例
print("Hello World")
**字段说明:**
| 字段 | 必填 | 说明 |
|------|------|------|
| `layout` | 是 | 固定填 `post` |
| `title` | 是 | 文章标题,用引号包裹 |
| `date` | 是 | 格式 `YYYY-MM-DD` |
| `categories` | 否 | 侧边栏分类,建议只填一个 |
| `tags` | 否 | 文章标签,可填多个 |
### 3. 提交并发布
```bash
git add _posts/2026-03-01-my-new-post.md
git commit -m "add new post: 文章标题"
git push
推送后 GitHub Actions 自动构建,约 1~2 分钟上线。
二、删除文章
直接删除对应的文件,然后提交:
rm _posts/2026-03-01-my-new-post.md
git add -A
git commit -m "delete post: 文章标题"
git push
三、在文章中插入图片
方式一:使用外部图片链接(最简单)

方式二:上传图片到博客
- 将图片放入
images/目录,例如images/my-photo.jpg - 在文章中引用:

- 提交时一并加入:
git add images/my-photo.jpg _posts/your-post.md
git commit -m "add post with image"
git push
四、添加电子书链接
编辑 index.html,在电子书区域添加新的 <li> 条目:
<ul class="list-unstyled">
<li><a ... href="https://adp.xindoo.xyz" target="_blank">adp.xindoo.xyz</a></li>
<!-- 在下面添加新链接 -->
<li><a class="link-primary link-offset-2 link-underline-opacity-25 link-underline-opacity-100-hover"
href="https://新的链接地址" target="_blank">显示名称</a></li>
</ul>
然后提交:
git add index.html
git commit -m "add ebook link"
git push
五、快速参考:常用 Markdown 语法
# 一级标题
## 二级标题
### 三级标题
**加粗**
*斜体*
~~删除线~~
[链接文字](https://example.com)

- 无序列表
- 列表项
1. 有序列表
2. 列表项
> 引用块
`行内代码`
```python
# 代码块(把开头的空格去掉)
print("hello")
```
| 表头一 | 表头二 |
|--------|--------|
| 内容一 | 内容二 |