|
1 | | -# 我的个人博客 My Personal Blog |
| 1 | +# MickeyMiao's Blog |
2 | 2 |
|
3 | | -[][gem] |
4 | | -[][mit] |
| 3 | +[](https://github.com/WangSimiao2000/wangsimiao2000.github.io/actions/workflows/pages-deploy.yml) |
5 | 4 |
|
6 | | -## 介绍 |
| 5 | +基于 [Jekyll](https://jekyllrb.com/) + [Chirpy](https://github.com/cotes2020/jekyll-theme-chirpy) 主题的个人博客。 |
7 | 6 |
|
8 | | -博客地址: [https://wangsimiao2000.github.io/](https://wangsimiao2000.github.io/) |
| 7 | +🔗 **博客地址**: [https://blog.mickeymiao.cn](https://blog.mickeymiao.cn) |
9 | 8 |
|
10 | | -这是我的个人博客, 使用 [Jekyll](https://jekyllrb.com/) 搭建, 主题是 [Chirpy](https://github.com/cotes2020/jekyll-theme-chirpy) |
| 9 | +## 项目结构 |
11 | 10 |
|
12 | | -使用[Chirpy-Starter](https://github.com/cotes2020/chirpy-starter)快速搭建 |
| 11 | +``` |
| 12 | +├── _config.yml # Jekyll 主配置 |
| 13 | +├── _posts/ # 博客文章 (Markdown) |
| 14 | +├── _tabs/ # 导航页面 (关于/归档/分类/标签/友链/相册/工具) |
| 15 | +├── _layouts/ # 页面布局模板 |
| 16 | +├── _includes/ # 可复用 HTML 片段 |
| 17 | +├── _sass/ # SCSS 样式源码 |
| 18 | +│ ├── abstracts/ # 变量、mixin、断点 |
| 19 | +│ ├── base/ # 基础样式、排版、语法高亮 |
| 20 | +│ ├── components/ # 按钮、弹窗等组件 |
| 21 | +│ ├── layout/ # 侧边栏、顶栏、页脚 |
| 22 | +│ ├── pages/ # 各页面专属样式 |
| 23 | +│ ├── themes/ # 亮色/暗色主题 |
| 24 | +│ └── vendors/ # Bootstrap 定制 |
| 25 | +├── _javascript/ # JS 源码 (Rollup 编译) |
| 26 | +│ ├── modules/ # 功能模块 (TOC/搜索/剪贴板/主题切换等) |
| 27 | +│ └── pwa/ # Service Worker + PWA |
| 28 | +├── _data/ # 数据文件 |
| 29 | +│ ├── locales/ # 国际化 (zh-CN, en) |
| 30 | +│ └── origin/ # CDN 库地址配置 |
| 31 | +├── _plugins/ # Jekyll 插件 (git lastmod hook) |
| 32 | +├── _scripts/ # 开发/部署脚本 |
| 33 | +├── assets/ # 静态资源 |
| 34 | +│ ├── css/ # 样式表 (含 Giscus 主题) |
| 35 | +│ ├── js/dist/ # 编译后 JS (CI 自动生成,不提交) |
| 36 | +│ ├── js/data/ # 搜索索引、SW 配置、MathJax |
| 37 | +│ ├── img/ # 头像、favicon、文章图片 |
| 38 | +│ └── lib/ # 第三方库 (本地托管) |
| 39 | +├── tools/ # 独立工具页面 |
| 40 | +│ └── bazi-fortune/ # 称骨算命 |
| 41 | +├── rollup.config.js # JS 构建配置 |
| 42 | +├── package.json # Node.js 依赖 |
| 43 | +└── Gemfile # Ruby 依赖 |
| 44 | +``` |
13 | 45 |
|
14 | | -搭建过程记录于[我的这篇博客文章](https://wangsimiao2000.github.io/posts/Building-a-Personal-Blog-with-GitHubPages/) |
| 46 | +## 开发 |
15 | 47 |
|
16 | | -参考了Chirpy的[文档](https://github.com/cotes2020/jekyll-theme-chirpy/wiki) |
| 48 | +### 环境要求 |
| 49 | + |
| 50 | +- Ruby 3.3+, Bundler |
| 51 | +- Node.js 20+, npm |
| 52 | + |
| 53 | +### 本地运行 |
| 54 | + |
| 55 | +```bash |
| 56 | +# 安装依赖 |
| 57 | +bundle install |
| 58 | +npm install |
| 59 | + |
| 60 | +# 构建 JS + 启动开发服务器 |
| 61 | +npm run dev |
| 62 | + |
| 63 | +# 或分步执行 |
| 64 | +npm run build # 编译 JS |
| 65 | +bundle exec jekyll s -l # 启动 Jekyll (livereload) |
| 66 | +``` |
| 67 | + |
| 68 | +### 常用命令 |
| 69 | + |
| 70 | +| 命令 | 说明 | |
| 71 | +|------|------| |
| 72 | +| `npm run build` | 编译 JS (production) | |
| 73 | +| `npm run watch` | JS 监听模式 | |
| 74 | +| `npm run dev` | 构建 + 启动开发服务器 | |
| 75 | +| `npm test` | 构建站点 + HTML 校验 | |
| 76 | + |
| 77 | +### 写文章 |
| 78 | + |
| 79 | +在 `_posts/` 下新建 Markdown 文件,格式:`YYYY-MM-DD-Title.md` |
| 80 | + |
| 81 | +```yaml |
| 82 | +--- |
| 83 | +title: 文章标题 |
| 84 | +date: 2024-01-01 12:00:00 +0800 |
| 85 | +categories: [分类1, 分类2] |
| 86 | +tags: [标签1, 标签2] |
| 87 | +math: false # 启用 MathJax |
| 88 | +mermaid: false # 启用 Mermaid 图表 |
| 89 | +image: /path.jpg # 封面图 |
| 90 | +pin: false # 置顶 |
| 91 | +--- |
| 92 | +``` |
| 93 | + |
| 94 | +## 部署 |
| 95 | + |
| 96 | +推送到 `main` 分支后,GitHub Actions 自动执行: |
| 97 | + |
| 98 | +1. 安装 Ruby + Node.js 依赖 |
| 99 | +2. `npm run build` 编译 JS |
| 100 | +3. 生成相册数据 (R2)、检查友链 |
| 101 | +4. `jekyll build` 构建站点 |
| 102 | +5. 部署到 GitHub Pages |
| 103 | + |
| 104 | +## 致谢 |
| 105 | + |
| 106 | +- 主题: [Chirpy](https://github.com/cotes2020/jekyll-theme-chirpy) by Cotes Chung |
| 107 | +- 评论: [Giscus](https://giscus.app/) |
| 108 | +- 图床: Cloudflare R2 |
17 | 109 |
|
18 | 110 | ## License |
19 | 111 |
|
20 | | -This work is published under [MIT][mit] License. |
| 112 | +[MIT](LICENSE) |
21 | 113 |
|
22 | 114 | [gem]: https://rubygems.org/gems/jekyll-theme-chirpy |
23 | 115 | [chirpy]: https://github.com/cotes2020/jekyll-theme-chirpy/ |
|
0 commit comments