本文介绍了基于 Chirpy Jekyll Theme 的个人博客环境的搭建方法,并介绍了部署到 github pages 的方法。
1. 前言
博客主题位于:https://github.com/cotes2020/jekyll-theme-chirpy
注意,本文内容可能随着时间的推移变得过时。
2. 图片
推荐在 assets/ 下面新建文件夹存放帖子图片,如 assets/postsimg/。
在 md 文件中直接使用路径,如  即可。
帖子的图片无论是在本地(如VSCode打开xxx.github.io文件夹作为根目录)还是在线上(如 https://xxx.github.io)均能正常显示。
3. 公式与流程图
Jekyll支持Markdown的公式和 Mermaid 流程图。在每个帖子开头增加 math: true 和 mermaid: true 即可。公式通过调用在线的 mathjax 来渲染。
1
2
3
4
5
6
7
8
---
title: xxxx
date: 20xx-xx-xx xx:xx:xx +0x00
categories: [xxx, aaa]
tags: [xxa]
math: true # <-- add this
mermaid: true # <-- add this
---
4. 关于页面
自行编辑 _tabs/about.md 文件。
5. 本地编辑和部署
通过下面的命令换源
1
bundle config set --global mirror.https://rubygems.org https://mirrors.tuna.tsinghua.edu.cn/rubygems
或者编辑本地的 Gemfile 文件,将 https://rubygems.org 替换为 https://mirrors.tuna.tsinghua.edu.cn/rubygems
通过下面的命令安装依赖包
1
bundle install
通过下面的命令启动服务
1
bundle exec jekyll serve
终端输出如下:
1
2
3
...
Server address: http://127.0.0.1:4000/ # <-- click here to open in browser
Server running... press ctrl-c to stop.