Hexo博客搭建

Hexo 博客搭建

安装

1
2
3
4
5
6
7
8
9
10
# 安装 hexo
npm install hexo-cli -g
# 初始化
hexo init blog

# 安装 next
cd blog
npm install hexo-theme-next
or
git clone https://github.com/next-theme/hexo-theme-next themes/next

命令

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
# 版本
hexo v
# 生成静态文件
hexo g
# 启动服务器
hexo s
# 部署网站
hexo d
# 清除缓存文件和已生成的静态文件
hexo clean
# 创建文章
hexo new filename
# 创建分类
# type: categories
hexo new page categories

配置 _config.next.yml

更多配置:https://theme-next.js.org/

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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
title: 开心
subtitle: '盛年不重来,一日难再晨。'
author: 开心
# 语言
language: zh-CN
# 博客地址
url: https://blog.ckx.ink
# 永久链接
permalink: :year/:month/:day/:hour:minute:second.html
# 文件名
new_post_name: :year/:month/:day/:title.md
# 选择主题
theme: next
# 一键部署
# npm install hexo-deployer-git --save
# hexo clean && hexo d
deploy:
type: git
repo: https://github.com/chenkaixin12121/chenkaixin12121.github.io
branch: main

# --------------------

# 菜单
menu:
home: / || fa fa-home
archives: /archives/ || fa fa-archive
categories: /categories/ || fa fa-th
tags: /tags/ || fa fa-tags
about: /about/ || fa fa-user
# 友链
links_settings:
layout: inline
links:
James Blog: https://dev-james.xyz
Abalone: https://abalone.life
木子李: https://blog.levnli.cn
柒月是ni的谎言: https://huangdf.xyz/
Kiritoghy: https://www.kiritoghy.cn/
# 社交链接
social:
GitHub: https://github.com/chenkaixin12121
E-Mail: mailto:chenkaixin12121@163.com
# 关注我
github_banner:
enable: true
permalink: https://github.com/chenkaixin12121
# 主题设定
scheme: Gemini
# 头像
avatar:
url: /upload/2020/04/微信图片_20200424230314-953bf9e05fa94cf5bedc5acf2e25b8c5.jpg
rotated: true
# 博客图标
favicon:
small: /upload/2020/04/微信图片_20200424230314-95-32x32.jpg
medium: /upload/2020/04/微信图片_20200424230314-95-32x32.jpg
# 页脚
footer:
# 站点建立时间
since: 2020
# 备案
beian:
enable: true
icp: 豫ICP备20013274号-1
# 来必力评论
# comments: false 指定页面不显示评论
livere_uid: abc
# 搜索
# npm install hexo-generator-searchdb
local_search:
enable: true
# 字数统计
symbols_count_time:
separated_meta: true
item_text_total: false
symbols: true
time: true
total_symbols: true
total_time: true
exclude_codeblock: false
awl: 2
wpm: 300
suffix: "mins."
# 不蒜子
busuanzi_count:
enable: true
total_visitors: true
total_visitors_icon: fa fa-user
total_views: true
total_views_icon: fa fa-eye
post_views: true
post_views_icon: far fa-eye
# 阅读进度
reading_progress:
enable: true
# 加载进度
pace:
enable: true
color: blue
theme: minimal
# 版权声明
creative_commons:
license: by-nc-sa
size: small
sidebar: true
post: true
# 返回顶部
back2top:
enable: true
sidebar: true
scrollpercent: true
# 书签
bookmark:
enable: true
color: "#222"
save: auto
# 懒加载
lazyload: true
# 图片操作,放大,快速浏览
fancybox: true
# 中英文添加空格
pangu: true
# 代码块
codeblock:
theme:
light: default
dark: stackoverflow-dark
prism:
light: prism
dark: prism-dark
copy_button:
enable: false
style: default
# 本地 CDN
# npm install @next-theme/plugins
vendors:
plugins: local

自定义域名

  1. source 目录下创建 CNAME 文件,添加内容 blog.ck.ink
  2. Github 配置
    image.png
  3. 域名解析 配置
    image.png
  4. 配置完成之后,访问 https://blog.ckx.ink

腾讯云 CDN 加速

  1. 基础配置(回源地址 ping yourname.github.io)
    image.png
    image.png
  2. HTTPS 配置
    image.png
  3. 修改 blog 域名解析为 CDN 的 CNAME
    image.png
  4. 配置完成之后,访问 https://blog.ckx.ink