发表于 2026年07月17日

安装AutoBlog静态博客记录

这是什么?(给想搭博客的你) AutoBlog 用来把你写的 Markdown 文章生成一个完整的静态博客站点,并且可以通过一条命令部署到 GitHub Pages。

你会得到:

文章页+首页列表 标签页、归档页、站内搜索 RSS + 站点地图(配置site_url后自动生成) 你只需要:用 Markdown 写文章,执行构建/配置命令。

5分钟上手:从0到上线 0)准备 安装Python 3.10+ 本地有Git 有一个 GitHub 仓库(用于承载博客)

1)克隆项目

git clone https://github.com/ChenyuHeee/AutoBlog
cd AutoBlog
python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt

创建您的站点配置 把示例配置复制为正式配置:

cp source/config.yaml.example.yaml source/config.yaml

然后编辑source/config.yaml(下面是一个最小示例,按你的仓库信息修改):

nav_links:
  - label: 首页
    url: /
  - label: 标签
    url: /tags/
  - label: GitHub
    url: https://github.com/YourName/YourRepo

contacts:
  - label: 邮箱:you@example.com
    url: mailto:you@example.com
    icon: mail
  - label: GitHub @YourName
    url: https://github.com/YourName
    icon: github

github_repo: your-user/your-repo
github_branch: gh-pages
github_remote: origin

# 关键:base_url 决定 GitHub Pages 路径
# 1) 如果是“项目页”(https://your-user.github.io/your-repo/):
base_url: /your-repo/
# 2) 如果是“个人主页”(https://your-user.github.io/):
# base_url: /

# 推荐:填上绝对站点地址以生成 RSS/sitemap 的绝对链接
# site_url: https://your-user.github.io/your-repo/
写第一篇文章 在下source/posts/新建一个Markdown,例如:
---
title: "Hello AutoBlog"
date: 2025-12-29
slug: hello
description: "我的第一篇博客。"
---

这里写正文。
本地预览 推荐:使用桌面端编辑器直接点击“构建”+“打开预览”。

命令行方式:

python3 build.py