GitHub Pages 部署指南
GitHub Pages 部署指南
📋 前提条件
- 已创建 GitHub 仓库:
xvcenh/xvcenh.github.io - 已配置 Git 远程仓库
- 已安装 Git
🚀 部署步骤
1. 推送代码到 GitHub
cd /home/annisen/BLOG/xvcenh.github.io
# 添加所有文件
git add .
# 提交更改
git commit -m "初始化项目问题库:现代化界面设计"
# 推送到 GitHub
git push origin main
2. 配置 GitHub Pages
- 访问 https://github.com/xvcenh/xvcenh.github.io
- 点击 “Settings” → “Pages”
- 在 “Build and deployment” 部分:
- Source: “Deploy from a branch”
- Branch: “main” → “/ (root)”
- 点击 “Save”
3. 等待构建完成
GitHub Actions 会自动构建 Jekyll 站点,通常需要 1-2 分钟。
4. 访问网站
构建完成后,访问:https://xvcenh.github.io
⚙️ 配置说明
Jekyll 配置 (_config.yml)
title: "项目问题库"
baseurl: ""
url: "https://xvcenh.github.io"
theme: minima
plugins:
- jekyll-feed
- jekyll-sitemap
- jekyll-paginate
- jekyll-seo-tag
GitHub Actions 工作流 (.github/workflows/jekyll.yml)
已配置自动构建和部署工作流。
🔧 故障排除
问题 1:构建失败
- 检查
_config.yml语法 - 查看 GitHub Actions 日志
问题 2:页面空白
- 检查 CSS/JS 路径
- 确认资源文件已上传
问题 3:样式不生效
- 清除浏览器缓存
- 检查 CSS 文件路径
📝 添加新文章
方法 1:手动创建
- 在
_posts/目录创建 Markdown 文件 - 文件名格式:
YYYY-MM-DD-标题.md - 推送更改到 GitHub
方法 2:通过钉钉自动上传
- 在钉钉群中@机器人
- 上传文档或发送问题描述
- 系统自动创建文章并推送
🔄 更新网站
# 本地修改后
git add .
git commit -m "更新内容"
git push origin main
GitHub Pages 会自动重新构建。
📊 监控状态
- GitHub Actions: https://github.com/xvcenh/xvcenh.github.io/actions
- Pages 状态: https://github.com/xvcenh/xvcenh.github.io/settings/pages
- 网站访问: https://xvcenh.github.io
🎯 成功指标
- ✅ 网站可访问:https://xvcenh.github.io
- ✅ 样式正常加载
- ✅ 文章显示正常
- ✅ 搜索功能可用
- ✅ 响应式设计正常
💡 高级功能
自定义域名
- 购买域名
- 在 DNS 设置中添加 CNAME 记录
- 在 GitHub Pages 设置中添加自定义域名
统计分析
- 添加 Google Analytics
- 配置在
_config.yml中
评论系统
- 集成 Disqus 或 Giscus
- 添加到文章模板中
📞 支持
如有问题,请参考: