GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • ItsFated
  • 归档
  • 标签
  • 分类
  • 数学表达式计算器
  • 主站
  • 关于
  • 建站

This view

  • Original page
  • New address

GeezerVison is showing itsfated.github.io — Hexo

官网:hexo

Github:hexo

部署记录:文档

Install NodeJS

1
2
3
4
5
6
7
8
9
# 不用Root
# installs fnm (Fast Node Manager)
curl -fsSL https://fnm.vercel.app/install | bash
# download and install Node.js
fnm use --install-if-missing 22
# verifies the right Node.js version is in the environment
node -v # should print `v22.4.1`
# verifies the right NPM version is in the environment
npm -v # should print `10.8.1`

安装Hexo

1
2
3
4
# 全局
npm install -g hexo-cli
# 局部
npm install hexo

Hello World

1
2
3
4
5
6
7
8
9
# 创建一个项目
hexo init demo
cd demo
# 安装依赖
npm install
# 生成页面,创建项目会自带一个hello_world.md页面
hexo generate
# 运行访问:http://localhost:4000
hexo server

在 GitHub Pages 上部署 Hexo

GitHub上找一个Hexo仓库(可以是自己的用户名仓库),下载到本地安装hexo-deployer-git

1
2
3
4
# 安装:hexo-deployer-git
npm install hexo-deployer-git --save
git add .
git commit -m "install hexo-deployer-git"

注意需要将GitHub仓库中的Pages改为Actions!!!再继续!!!
修改 .github/workflows/pages.yml (创建新文件,Actions文件)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
name: Pages

on:
push:
branches:
- main # default branch

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
# If your repository depends on submodule, please see: https://github.com/actions/checkout
submodules: recursive
- name: Use Node.js 22
uses: actions/setup-node@v4
with:
# Examples: 20, 18.19, >=16.20.2, lts/Iron, lts/Hydrogen, *, latest, current, node
# Ref: https://github.com/actions/setup-node#supported-version-syntax
node-version: "22"
- name: Cache NPM dependencies
uses: actions/cache@v4
with:
path: node_modules
key: ${{ runner.OS }}-npm-cache
restore-keys: |
${{ runner.OS }}-npm-cache
- name: Install Dependencies
run: npm install
- name: Build
run: npm run build
- name: Upload Pages artifact
uses: actions/upload-pages-artifact@v3
with:
path: ./public
deploy:
needs: build
permissions:
pages: write
id-token: write
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4

修改 _config.yml(部分)

1
2
3
4
5
url: https://itsfated.github.io/itsfated
deploy:
type: 'git'
repo: [email protected]:ItsFated/itsfated.git
branch: gh-pages

提交这两个文件的修改后,Github会自动执行Actions

配置Butterfly主题

参考:Butterfly 安裝文檔(一) 快速開始

第一步:修改 Hexo 根目錄下的 _config.yml,把主題改為 butterfly。

1
theme: butterfly

第二步:安装:npm install hexo-renderer-pug hexo-renderer-stylus --save

第三步:使用替代主题配置文件

1
2
3
4
5
6
7
8
find . -iname "_config*"
cp ./node_modules/hexo-theme-butterfly/_config.yml _config.butterfly.yml
# 后续修改主题可以直接修改 _config.butterfly.yml,如下配置开启404页面
vi _config.butterfly.yml
# 修改参考如下内容
error_404:
enable: true
subtitle: "页面没有找到"

第四步:Butterfly 安裝文檔(二) 主題頁面,子页面(tags、categries等)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
hexo new page tags
vi source/tags/index.md
# 修改参考如下内容
---
title: 标签
date: 2018-01-05 00:00:00
type: "tags"
orderby: random
order: 1
---
hexo new page categories
vi source/categories/index.md
# 修改参考如下内容
---
title: 分类
date: 2018-01-05 00:00:00
type: "categories"
---

第五步:重新部署

1
2
3
hexo clean
hexo generate
hexo server

配置Butterfly评论系统

Valine是一款快速、简洁且高效的无后端评论系统,用作Hexo的评论系统非常简单快捷,而且有很多博主也用的是它:hexo - Next 主题添加评论功能,国光……

Giscus是利用 GitHub Discussions 实现的评论系统,让访客借助 GitHub 在你的网站上留下评论。
按照官网步骤进行:

  1. 该仓库是公开的,否则访客将无法查看 discussion。
  2. giscus app 已安装,否则访客将无法评论和回应。
  3. Discussions 功能已在你的仓库中启用。

修改配置文件_config.butterfly.yml

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
comments:
use: Giscus # Valine,Disqus
giscus:
repo: itsfated/itsfated
repo_id: R_kgDOMVetDQ
category_id: DIC_kwDOMVetDc4Cgx1_
theme:
light: light
dark: dark
option:
data-category: General
data-mapping: title
data-strict: 0
data-reactions-enabled: 1
data-emit-metadata: 0
data-input-position: bottom
data-theme: preferred_color_scheme
data-lang: zh-CN
crossorigin: anonymous
文章作者: ItsFated
文章链接: https://itsfated.github.io/2024/07/12/Hexo/
版权声明: 本博客所有文章除特别声明外,均采用 CC BY-NC-SA 4.0 许可协议。转载请注明来源 ItsFated!
博客网站GithubNodeJSHexo
相关推荐
cover
2024-07-14
Hugo
首次部署安装hugo Linux安装hugo:sudo snap install hugo Windows安装hugo:winget install Hugo.Hugo.Extended 安装Git winget安装:winget install Git.Git 下载安装包:Download for Windows 创建第一个项目:Quick start 1234567891011# 官网指导hugo new site quickstartcd quickstartgit initgit submodule add https://github.com/theNewDynamic/gohugo-theme-ananke.git themes/anankeecho "theme = 'ananke'" >> hugo.tomlhugo server# 启动hugo server# 启动时指定绑定端口和IPhugo server -p 8080 --bind 192.168.108.132 基础操作:Front matter...

评论
ValineGiscus
avatar
ItsFated
超频和弦的小站
文章
8
标签
17
分类
5
Follow Me
公告
没有公告
目录
  1. 1. 官网:hexo
  2. 2. 部署记录:文档
  3. 3. 在 GitHub Pages 上部署 Hexo
  4. 4. 配置Butterfly主题
  5. 5. 配置Butterfly评论系统
最新文章
王者荣耀:从入门到精通
王者荣耀:从入门到精通2026-02-27
被动独处 vs 主动独处
被动独处 vs 主动独处2025-08-29
AI服务器
AI服务器2025-02-26
I5 13600K PVE虚拟机核显直通+双屏方案+共用键鼠
I5 13600K PVE虚拟机核显直通+双屏方案+共用键鼠2025-02-23
异人之下
异人之下2024-08-31
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.