Skip to content

Hexo 搭建

bash
FROM node:20.15.0-alpine3.20

# 设置工作目录
WORKDIR /app

# 安装 Hexo CLI
RUN npm install -g hexo-cli

# 开放端口
EXPOSE 4000

# 运行 Hexo 服务器
CMD ["sh"]
bash
# 构建容器
docker build -t hexo-aurora .

# 运行容器
docker run -it --rm  -p 4000:4000 -v $PWD/app:/app --name hexo-aurora hexo-aurora
bash
# 初始化项目
hexo init

# 安装基础依赖
npm install

# 安装admin
npm install hexo-admin -S

# 安装了admin就不需要安装hexo-server了
# npm install hexo-server -S

# 安装主题
npm install hexo-theme-aurora hexo-plugin-aurora -S
bash
hexo server -i 0.0.0.0

配置aurora主题

参考: https://aurora.tridiamond.tech/en/guide/getting-started.html

yaml

# aurora 主题配置
theme: aurora

permalink: /post/:title.html

# 禁用这两个
highlight:
  enable: false
prismjs:
  enable: false
  
# 使用shiki高亮
shiki:
  enable: true
  backgroundColor: '#1a1a1a'

# hexo-admin 配置
# 访问页面后,进入/admin/ 生成配置文件
# hexo-admin authentification
admin:
  username: hexo
  password_hash: $xxxxxQS
  secret: xxxx
yaml

## 需要放开作者信息,否则admin编辑的时候报错

# authors:
##! example
# TriDiamond:
#   name: TriDiamond
#   avatar: https://up.enterdesk.com/edpic_source/44/ff/3d/44ff3d6bd2819d524facfcc33205d4cd.jpg
#   link: https://github.com/TriDiamond
#   description: 'Think like an artist, code like an artisan.'
#   socials:
#     github: https://tridiamond.tech

人生感悟