-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Revise article and add table of contents
- Loading branch information
1 parent
ae0878d
commit 38917a7
Showing
10 changed files
with
122 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
--- | ||
title: Hexo 环境搭建 | ||
date: 2023-12-28 19:08:02 | ||
tags: | ||
--- | ||
|
||
我是 `Linux` 操作系统 `Manjaro` 分支,所以文章着重介绍 `Linux` 下的环境搭建。 | ||
`Windows` 下的环境搭建有不小的差异,但是原理是一样的。 | ||
|
||
### 1. 检查 Git 环境 | ||
|
||
- `Linux` 大多数发行版都默认安装了 Git,所以我们只需要检查一下 Git 版本。 | ||
```bash | ||
git --version | ||
``` | ||
输出如下内容。 | ||
```bash | ||
git version 2.43.0 | ||
``` | ||
- `Windows` 下的 安装 Git 可以参考 [Git 官网](https://git-scm.com/downloads),或者搜索教程。 | ||
|
||
### 2. 安装 Node.js 和 npm | ||
|
||
npm 的依赖项就是 nodejs。所以安装 npm, nodejs 会一起被安装。 | ||
|
||
- `Debian` 系安装 npm 和 nodejs | ||
|
||
```bash | ||
sudo apt install npm | ||
``` | ||
检验版本 | ||
```bash | ||
node -v | ||
npm -v | ||
``` | ||
|
||
<br> | ||
|
||
- `ArchLinux` 系安装 npm 和 nodejs | ||
|
||
```bash | ||
sudo pacman -S npm | ||
``` | ||
检验版本 | ||
```bash | ||
node -v | ||
npm -v | ||
``` | ||
|
||
- `Windows` 下的 安装 Node.js 和 npm 可以参考 [Node.js 官网](https://nodejs.org/en/download/),或者搜索教程。 | ||
|
||
和上面一样,安装完毕后检验版本。 | ||
|
||
记住上面的 nodejs 的版本号,后面会用到。 | ||
|
||
### 3. 安装 Hexo | ||
|
||
注:如果是 `Windows` 系统,需要空白处单击鼠标右键,选择“Git Bash Here”输入以下命令。 | ||
|
||
Linux 系统直接打开终端输入即可。 | ||
```bash | ||
npm install hexo-cli -g | ||
``` | ||
安装完毕后,输入以下命令检验是否安装成功。 | ||
```bash | ||
hexo -v | ||
``` | ||
如果没有报错而是输出版本号,就说明安装成功了。 | ||
反之则根据报错信息进行排查。 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,6 @@ | ||
--- | ||
title: 我的第一篇 Hexo 博客 | ||
date: 2023-12-26 23:18:38 | ||
sticky: 100 | ||
tags: | ||
- hexo | ||
- github | ||
|
@@ -19,7 +18,7 @@ tags: | |
> 最终实现的效果,一个项目仓库,`main` 分支存放源代码,`gh-pages` 存放生成后的网页代码,github pages 加载 `gh-pages` 的网页代码。 | ||
> 这样,每当我们 push 代码到 `main` 分支的时候,github action 会自动构建并将代码发布到 `gh-pages` 分支,github pages 会自动加载 `gh-pages` 分支的代码,这样就实现了自动部署。 | ||
搭建环境: | ||
环境: | ||
|
||
> linux plasma manjaro | ||
> nodejs 20 | ||
|
@@ -45,7 +44,7 @@ tags: | |
|
||
![deploy-key1.webp](../images/My-first-hexo-blog/deploy-key1.webp) | ||
|
||
填入你的私钥 | ||
填入你的私钥 取名为 `KEY`,后面要用到 | ||
![deploy-key2.webp](../images/My-first-hexo-blog/deploy-key2.webp) | ||
|
||
### 3. 初始化 hexo 博客目录 | ||
|
@@ -69,7 +68,7 @@ git commit -m "Initial commit" | |
执行结果如下 | ||
![init-git.webp](../images/My-first-hexo-blog/init-git.webp) | ||
|
||
把下面 git@xxx 地址换成你仓库的 ssh 地址 | ||
把下面 git@xxx 地址换成你`仓库的ssh地址` | ||
|
||
```bash | ||
git remote add origin [email protected]:mobeicanyue/mobeicanyue.github.io.git | ||
|
@@ -102,8 +101,8 @@ git push -u origin master | |
|
||
![new-file.webp](../images/My-first-hexo-blog/new-file.webp) | ||
|
||
下面的代码只需要修改你的用户名和邮箱 | ||
|
||
下面的代码需要修改你的用户名和邮箱 | ||
还有你对应的 nodejs 版本 | ||
|
||
```yml | ||
name: Deploy Hexo | ||
|
@@ -149,9 +148,11 @@ jobs: | |
hexo deploy | ||
``` | ||
上面的`${{ secrets.KEY }}` 就是我们前面设置的私钥 | ||
|
||
<br> | ||
|
||
3) 最后提交代码并推送 | ||
1) 最后提交代码并推送 | ||
![commit-push.webp](../images/My-first-hexo-blog/commit-push.webp) | ||
|
||
### 7. 访问站点,部署成功! | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
--- | ||
title: 构建博客教程 | ||
date: 2023-12-28 19:03:00 | ||
sticky: 100 | ||
tags: | ||
--- | ||
## 目录 | ||
|
||
### Hexo Github-Pages 自动部署 | ||
- [Hexo 环境搭建](Build-the-environment.md) | ||
- [部署 Hexo](My-first-hexo-blog.md) | ||
- [博客域名配置](Configure-blog-domain.md) | ||
|
||
### Fluid 主题、美化相关 | ||
- [Fluid 主题安装](Fluid-theme-installation.md) | ||
- [在 Fluid 主题中使用霞鹜文楷](Use-lxgw-wenkai-in-fluid.md) | ||
- [修复 Github Pages 上的文章更新时间](Fix-article-updated-time-on-github-pages.md) | ||
- [Hexo Fluid 设置页脚](Hexo-Fluid-set-footer.md) | ||
|
||
### 博客性能优化 | ||
- [将 jpg 转换为 webp](Convert-jpg-to-webp.md) | ||
- [压缩部署的代码](Compress-deploy-code-size.md) | ||
|