Skip to content

Commit 3cc1e4c

Browse files
chore: 优化项目结构和开发体验
- 清理空的 _includes/analytics/ 目录 - 更新 package.json: 修正作者信息,添加 dev/test 脚本 - 清理 _config.yml: 更新描述,排除构建文件 - 添加 .editorconfig 统一代码风格 - 重写 README.md 项目文档
1 parent 00dcc09 commit 3cc1e4c

4 files changed

Lines changed: 132 additions & 15 deletions

File tree

.editorconfig

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# https://editorconfig.org
2+
root = true
3+
4+
[*]
5+
charset = utf-8
6+
indent_style = space
7+
indent_size = 2
8+
end_of_line = lf
9+
insert_final_newline = true
10+
trim_trailing_whitespace = true
11+
12+
[*.md]
13+
trim_trailing_whitespace = false
14+
15+
[*.{yml,yaml}]
16+
indent_size = 2
17+
18+
[Makefile]
19+
indent_style = tab

README.md

Lines changed: 102 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,115 @@
1-
# 我的个人博客 My Personal Blog
1+
# MickeyMiao's Blog
22

3-
[![Gem Version](https://img.shields.io/gem/v/jekyll-theme-chirpy)][gem] 
4-
[![GitHub license](https://img.shields.io/github/license/cotes2020/chirpy-starter.svg?color=blue)][mit]
3+
[![Build and Deploy](https://github.com/WangSimiao2000/wangsimiao2000.github.io/actions/workflows/pages-deploy.yml/badge.svg)](https://github.com/WangSimiao2000/wangsimiao2000.github.io/actions/workflows/pages-deploy.yml)
54

6-
## 介绍
5+
基于 [Jekyll](https://jekyllrb.com/) + [Chirpy](https://github.com/cotes2020/jekyll-theme-chirpy) 主题的个人博客。
76

8-
博客地址: [https://wangsimiao2000.github.io/](https://wangsimiao2000.github.io/)
7+
🔗 **博客地址**: [https://blog.mickeymiao.cn](https://blog.mickeymiao.cn)
98

10-
这是我的个人博客, 使用 [Jekyll](https://jekyllrb.com/) 搭建, 主题是 [Chirpy](https://github.com/cotes2020/jekyll-theme-chirpy)
9+
## 项目结构
1110

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+
```
1345

14-
搭建过程记录于[我的这篇博客文章](https://wangsimiao2000.github.io/posts/Building-a-Personal-Blog-with-GitHubPages/)
46+
## 开发
1547

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
17109

18110
## License
19111

20-
This work is published under [MIT][mit] License.
112+
[MIT](LICENSE)
21113

22114
[gem]: https://rubygems.org/gems/jekyll-theme-chirpy
23115
[chirpy]: https://github.com/cotes2020/jekyll-theme-chirpy/

_config.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ timezone: Asia/Shanghai
1414
title: MickeyMiao
1515
tagline: code is cheap, show me your prompt
1616
description: >-
17-
A minimal, responsive and feature-rich Jekyll theme for technical writing.
17+
MickeyMiao 的个人博客,记录技术学习、图形学笔记和生活感悟。
1818
url: "https://blog.mickeymiao.cn"
1919

2020
github:
@@ -130,6 +130,10 @@ exclude:
130130
- README.md
131131
- LICENSE
132132
- _javascript
133+
- rollup.config.js
134+
- package.json
135+
- package-lock.json
136+
- node_modules
133137

134138
jekyll-archives:
135139
enabled: [categories, tags]

package.json

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,15 @@
22
"name": "wangsimiao2000.github.io",
33
"version": "1.0.0",
44
"private": true,
5-
"since": "2019",
6-
"author": "Cotes Chung",
5+
"description": "MickeyMiao's personal blog based on Jekyll Chirpy theme",
6+
"author": "Wang Simiao",
77
"license": "MIT",
8-
"homepage": "https://github.com/cotes2020/jekyll-theme-chirpy/",
8+
"homepage": "https://blog.mickeymiao.cn",
99
"scripts": {
1010
"build": "BUILD=production npx rollup -c --bundleConfigAsCjs",
11-
"watch": "npx rollup -c --bundleConfigAsCjs -w"
11+
"watch": "npx rollup -c --bundleConfigAsCjs -w",
12+
"dev": "npm run build && bash _scripts/run.sh",
13+
"test": "bash _scripts/test.sh"
1214
},
1315
"devDependencies": {
1416
"@babel/core": "^7.24.0",

0 commit comments

Comments
 (0)