这是一个使用Minimal Mistakes主题的Jekyll博客。以下是在本地运行和测试的详细步骤。
Windows用户:
验证Ruby安装:
ruby --version
gem --version
bundler --version
确保Git已安装并配置好,用于版本控制。
在项目根目录下运行:
gem uninstall bundler -v 2.2.26
gem install bundler
rm Gemfile.lock
bundle install
如果遇到权限问题,可以尝试:
bundle install --user-install
bundle exec jekyll serve
或者使用带有实时重载的命令:
bundle exec jekyll serve --livereload
打开浏览器,访问:
http://localhost:4000
bundle exec jekyll build
bundle exec jekyll clean
bundle exec jekyll serve --watch
bundle exec jekyll serve --drafts
_config.yml
- Jekyll配置文件_posts/
- 博客文章目录_layouts/
- 页面布局模板_includes/
- 可重用的页面组件_sass/
- Sass样式文件assets/
- 静态资源(图片、CSS、JS等)Gemfile
- Ruby依赖配置_posts/
目录下创建新文件YYYY-MM-DD-title.md
---
layout: single
title: "文章标题"
date: 2024-01-01
categories: [category1, category2]
tags: [tag1, tag2]
---
文章内容...
# 更新gem
gem update --system
# 清理并重新安装
bundle clean --force
bundle install
# 使用不同端口
bundle exec jekyll serve --port 4001
# 使用用户级安装
bundle install --user-install
在命令行中设置编码:
chcp 65001
这个博客配置为使用GitHub Pages,推送到main分支即可自动部署:
git add .
git commit -m "更新内容"
git push origin main