# hexo + github 配置

之前用 readthedoc 感觉体验不好,又看到了 https://shoka.lostyu.me/computer-science/note/theme-shoka-doc/ 大佬的博客页面,本二次元跃跃欲试,就直接冲!

# 安装 hexo

hexo 基于 node.js,使用 npm 安装

1
2
3
4
5
6
npm install  -g hexo-cli
mkdir /path/to/hexo/root/dir/
hexo init /path/to/hexo/root/dir/ # 初始化
cd /path/to/hexo/root/dir/
npm install
npm install hexo-server --save

主题安装参考 https://shoka.lostyu.me/computer-science/note/theme-shoka-doc/ (注意安装插件)

或者选用自己喜欢的主题

# hexo + github 配置

基于 Github pages 构建 hexo 博客

  1. 创建 github repositories

    此处名称必须为 username.github.io ,否则出现 404https://github.com/hexojs/hexo/issues/350

  2. 进入 hexo root 目录

    1
    npm install hexo-deployer-git --save
  3. 编辑_config.yml 文件

    1
    2
    3
    4
    5
    deploy:
    type: 'git'
    repo: https://github.com/username/username.github.io
    # https://github.com/username/username.github.io.git
    branch: main
  4. 设置 github repositories

    pages -> Build and deployment -> 设置 soure 为 main

    可通过 GitHub Pages 访问或者直接访问 https://username.github.io

# hexo 使用

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# git cmd command
cd /path/to/hexo/root/dir/
hexo n "VAE"

# 设置Front matter
#---
#title: VAE
#date: 2024-12-24 10:39:33
#tags:
#- Mechine learning
#categories:
#- Mechine learning
#keywords:
#- Mechine learning
#- VAE
#math: true
#mermaid: true
#---

hexo clean && hexo g
hexo s #预览
hexo d #上传

# 花里胡哨的功能

20241224

可设置随机图床,D:\0_Project\hexo\themes\shoka\config.yml

image_server: "https://api.paugram.com/wallpaper"

Continuing

# 参考

https://shoka.lostyu.me/computer-science/note/theme-shoka-doc/

https://blog.csdn.net/weixin_43659725/article/details/125207383

https://blog.csdn.net/yaorongke/article/details/119089190

Edited on