0%

Hexo搭建NexT主题静态博客系统

Hexo作为便捷简约的日志展示程序,可以作为信息分享、文本展示、笔记记录之用。
Hexo是本站家庭数据中心计划的第一部分,后续还有calibre书库系统、emby流媒体系统、seafile文件管理系统等,旨在提供完整的家庭数据中心方案。Make it a smarter home! Make it a better world!
本文主要介绍,在debian10上,使用Hexo和NexT主题搭建静态博客系统,以及相关优化配置、添加一些功能和一些故障的处理方法。

为什么使用Hexo?

  • 部署方便,一套梭哈
  • 方便备份,只需要备份md和config文件即可
  • 对比wordpress、typecho、emlog轻量简约,纯静态部署,速度快
  • NexT主题简洁美观

首先列一下相关资料,有一定阅读能力的小伙伴可以依葫芦画瓢,自行造轮子啦

来源 内容
https://hexo.io/zh-cn/docs hexo文档
https://github.com/nodesource/distributions node.js文档
https://theme-next.js.org/docs/ next主题文档
http://theme-next.iissnan.com/ theme-next.iissnan
https://blog.csdn.net/qq_34243930/article/details/109046865 添加统计文章阅读量
https://blog.csdn.net/u012195214/article/details/79204088 主题的优化定制修改指南
https://blog.csdn.net/darkbluejoli/article/details/108678705 添加阅读更多的预览功能
https://blog.csdn.net/birdfly2015/article/details/104216232 ERROR Template render error

部署 Hexo

准备工作
系统环境 Debian 10
程序依赖 Node.js Git

安装 Node.js v15.x:

why Node.js v15.x
 https://www.runoob.com  (2021-02-22) 

Node.js 版本需不低于 10.13,建议使用 Node.js 12.0 及以上版本

这里演示使用了最新的 Node.js v15.x,为避免产生一些令人头疼的问题,还是建议使用 Node.js v12.x

1
2
curl -fsSL https://deb.nodesource.com/setup_15.x | bash -
apt-get install -y nodejs
实机演示
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
[email protected]:~# curl -fsSL https://deb.nodesource.com/setup_15.x | bash -

## Installing the NodeSource Node.js 15.x repo...


## Populating apt-get cache...

+ apt-get update
Hit:1 http://deb.debian.org/debian buster InRelease
Hit:2 http://security.debian.org/debian-security buster/updates InRelease
Reading package lists... Done

## Installing packages required for setup: gnupg...

+ apt-get install -y gnupg > /dev/null 2>&1

## Confirming "buster" is supported...

+ curl -sLf -o /dev/null 'https://deb.nodesource.com/node_15.x/dists/buster/Release'

## Adding the NodeSource signing key to your keyring...

+ curl -s https://deb.nodesource.com/gpgkey/nodesource.gpg.key | apt-key add -
OK

## Creating apt sources list file for the NodeSource Node.js 15.x repo...

+ echo 'deb https://deb.nodesource.com/node_15.x buster main' > /etc/apt/sources.list.d/nodesource.list
+ echo 'deb-src https://deb.nodesource.com/node_15.x buster main' >> /etc/apt/sources.list.d/nodesource.list

## Running `apt-get update` for you...

+ apt-get update
Hit:1 http://deb.debian.org/debian buster InRelease
Hit:2 http://security.debian.org/debian-security buster/updates InRelease
Get:3 https://deb.nodesource.com/node_15.x buster InRelease [4,584 B]
Get:4 https://deb.nodesource.com/node_15.x buster/main amd64 Packages [767 B]
Fetched 5,351 B in 1s (5,575 B/s)
Reading package lists... Done

## Run `sudo apt-get install -y nodejs` to install Node.js 15.x and npm
## You may also need development tools to build native addons:
sudo apt-get install gcc g++ make
## To install the Yarn package manager, run:
curl -sL https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
sudo apt-get update && sudo apt-get install yarn
[email protected]:~# apt-get install -y nodejs
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
libpython-stdlib libpython2-stdlib libpython2.7-minimal libpython2.7-stdlib python python-minimal python2
python2-minimal python2.7 python2.7-minimal
Suggested packages:
python-doc python-tk python2-doc python2.7-doc binutils binfmt-support
The following NEW packages will be installed:
libpython-stdlib libpython2-stdlib libpython2.7-minimal libpython2.7-stdlib nodejs python python-minimal
python2 python2-minimal python2.7 python2.7-minimal
0 upgraded, 11 newly installed, 0 to remove and 0 not upgraded.
Need to get 29.5 MB of archives.
After this operation, 132 MB of additional disk space will be used.
Get:1 http://deb.debian.org/debian buster/main amd64 libpython2.7-minimal amd64 2.7.16-2+deb10u1 [395 kB]
Get:2 http://deb.debian.org/debian buster/main amd64 python2.7-minimal amd64 2.7.16-2+deb10u1 [1,369 kB]
Get:3 http://deb.debian.org/debian buster/main amd64 python2-minimal amd64 2.7.16-1 [41.4 kB]
Get:4 http://deb.debian.org/debian buster/main amd64 python-minimal amd64 2.7.16-1 [21.0 kB]
Get:5 http://deb.debian.org/debian buster/main amd64 libpython2.7-stdlib amd64 2.7.16-2+deb10u1 [1,912 kB]
Get:6 http://deb.debian.org/debian buster/main amd64 python2.7 amd64 2.7.16-2+deb10u1 [305 kB]
Get:7 http://deb.debian.org/debian buster/main amd64 libpython2-stdlib amd64 2.7.16-1 [20.8 kB]
Get:8 http://deb.debian.org/debian buster/main amd64 libpython-stdlib amd64 2.7.16-1 [20.8 kB]
Get:9 http://deb.debian.org/debian buster/main amd64 python2 amd64 2.7.16-1 [41.6 kB]
Get:10 http://deb.debian.org/debian buster/main amd64 python amd64 2.7.16-1 [22.8 kB]
Get:11 https://deb.nodesource.com/node_15.x buster/main amd64 nodejs amd64 15.9.0-1nodesource1 [25.3 MB]
Fetched 29.5 MB in 1s (23.6 MB/s)
debconf: delaying package configuration, since apt-utils is not installed
Selecting previously unselected package libpython2.7-minimal:amd64.
(Reading database ... 19975 files and directories currently installed.)
Preparing to unpack .../0-libpython2.7-minimal_2.7.16-2+deb10u1_amd64.deb ...
Unpacking libpython2.7-minimal:amd64 (2.7.16-2+deb10u1) ...
Selecting previously unselected package python2.7-minimal.
Preparing to unpack .../1-python2.7-minimal_2.7.16-2+deb10u1_amd64.deb ...
Unpacking python2.7-minimal (2.7.16-2+deb10u1) ...
Selecting previously unselected package python2-minimal.
Preparing to unpack .../2-python2-minimal_2.7.16-1_amd64.deb ...
Unpacking python2-minimal (2.7.16-1) ...
Selecting previously unselected package python-minimal.
Preparing to unpack .../3-python-minimal_2.7.16-1_amd64.deb ...
Unpacking python-minimal (2.7.16-1) ...
Selecting previously unselected package libpython2.7-stdlib:amd64.
Preparing to unpack .../4-libpython2.7-stdlib_2.7.16-2+deb10u1_amd64.deb ...
Unpacking libpython2.7-stdlib:amd64 (2.7.16-2+deb10u1) ...
Selecting previously unselected package python2.7.
Preparing to unpack .../5-python2.7_2.7.16-2+deb10u1_amd64.deb ...
Unpacking python2.7 (2.7.16-2+deb10u1) ...
Selecting previously unselected package libpython2-stdlib:amd64.
Preparing to unpack .../6-libpython2-stdlib_2.7.16-1_amd64.deb ...
Unpacking libpython2-stdlib:amd64 (2.7.16-1) ...
Selecting previously unselected package libpython-stdlib:amd64.
Preparing to unpack .../7-libpython-stdlib_2.7.16-1_amd64.deb ...
Unpacking libpython-stdlib:amd64 (2.7.16-1) ...
Setting up libpython2.7-minimal:amd64 (2.7.16-2+deb10u1) ...
Setting up python2.7-minimal (2.7.16-2+deb10u1) ...
Linking and byte-compiling packages for runtime python2.7...
Setting up python2-minimal (2.7.16-1) ...
Selecting previously unselected package python2.
(Reading database ... 20732 files and directories currently installed.)
Preparing to unpack .../python2_2.7.16-1_amd64.deb ...
Unpacking python2 (2.7.16-1) ...
Setting up python-minimal (2.7.16-1) ...
Selecting previously unselected package python.
(Reading database ... 20764 files and directories currently installed.)
Preparing to unpack .../python_2.7.16-1_amd64.deb ...
Unpacking python (2.7.16-1) ...
Selecting previously unselected package nodejs.
Preparing to unpack .../nodejs_15.9.0-1nodesource1_amd64.deb ...
Unpacking nodejs (15.9.0-1nodesource1) ...
Setting up nodejs (15.9.0-1nodesource1) ...
Setting up libpython2.7-stdlib:amd64 (2.7.16-2+deb10u1) ...
Setting up python2.7 (2.7.16-2+deb10u1) ...
Setting up libpython2-stdlib:amd64 (2.7.16-1) ...
Setting up python2 (2.7.16-1) ...
Setting up libpython-stdlib:amd64 (2.7.16-1) ...
Setting up python (2.7.16-1) ...
Processing triggers for mime-support (3.62) ...

安装 Git

1
apt-get install git-core
实机演示
1
2
3
4
5
6
7
8
[email protected]:~# apt-get install git-core -y
Reading package lists... Done
Building dependency tree
Reading state information... Done
Note, selecting 'git' instead of 'git-core'
git is already the newest version (1:2.20.1-2+deb10u3).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

安装 Hexo

1
npm install -g hexo-cli
实机演示
1
2
3
4
5
6
7
8
9
10
11
12
13
[email protected]:~# npm install -g hexo-cli

added 66 packages, and audited 67 packages in 6s

11 packages are looking for funding
run `npm fund` for details

found 0 vulnerabilities
npm notice
npm notice New patch version of npm available! 7.5.3 -> 7.5.4
npm notice Changelog: https://github.com/npm/cli/releases/tag/v7.5.4
npm notice Run npm install -g [email protected] to update!
npm notice

顺便更新一下npm

1
2
3
4
5
6
7
8
9
10
11
12
13
[email protected]:~# npm install -g [email protected]

removed 5 packages, changed 14 packages, and audited 254 packages in 4s

11 packages are looking for funding
run `npm fund` for details

found 0 vulnerabilities
npm notice
npm notice New patch version of npm available! 7.5.3 -> 7.5.4
npm notice Changelog: https://github.com/npm/cli/releases/tag/v7.5.4
npm notice Run npm install -g [email protected] to update!
npm notice

建站

1
2
3
4
mkdir hexo
hexo init hexo
cd hexo
npm install
实机演示
1
2
3
4
5
6
7
8
9
10
11
12
13
14
[email protected]:~# mkdir hexo
[email protected]:~# hexo init hexo
INFO Cloning hexo-starter https://github.com/hexojs/hexo-starter.git
INFO Install dependencies
INFO Start blogging with Hexo!
[email protected]:~# cd hexo/
[email protected]:~/hexo# npm install

added 6 packages, and audited 187 packages in 1s

15 packages are looking for funding
run `npm fund` for details

found 0 vulnerabilities

安装NexT主题

下载主题

1
git  clone https://github.com/theme-next/hexo-theme-next themes/next
实机演示
1
2
3
4
5
6
7
[email protected]:~/hexo# git clone https://github.com/iissnan/hexo-theme-next themes/next
Cloning into 'themes/next'...
remote: Enumerating objects: 12037, done.
remote: Total 12037 (delta 0), reused 0 (delta 0), pack-reused 12037
Receiving objects: 100% (12037/12037), 13.05 MiB | 10.20 MiB/s, done.
Resolving deltas: 100% (6964/6964), done.

启用主题

在配置文件中修改主题配置

1
vim _config.yml

将theme修改为 theme: next
修改配置文件

启动hexo,验证主题

清空缓存

1
hexo clean
实机演示
1
2
3
4
[email protected]:~/hexo# hexo clean
INFO Validating config
INFO Deleted database.

生成静态页面

1
hexo g
实机演示
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
[email protected]:~/hexo# hexo g
INFO Validating config
INFO Start processing
WARN ===============================================================
WARN ========================= ATTENTION! ==========================
WARN ===============================================================
WARN NexT repository is moving here: https://github.com/theme-next
WARN ===============================================================
WARN It's rebase to v6.0.0 and future maintenance will resume there
WARN ===============================================================
INFO Files loaded in 991 ms
(node:1843) Warning: Accessing non-existent property 'lineno' of module exports inside circular dependency
(Use `node --trace-warnings ...` to show where the warning was created)
(node:1843) Warning: Accessing non-existent property 'column' of module exports inside circular dependency
(node:1843) Warning: Accessing non-existent property 'filename' of module exports inside circular dependency
(node:1843) Warning: Accessing non-existent property 'lineno' of module exports inside circular dependency
(node:1843) Warning: Accessing non-existent property 'column' of module exports inside circular dependency
(node:1843) Warning: Accessing non-existent property 'filename' of module exports inside circular dependency
INFO Generated: archives/index.html
INFO Generated: archives/2021/02/index.html
INFO Generated: archives/2021/index.html
INFO Generated: images/algolia_logo.svg
INFO Generated: images/apple-touch-icon-next.png
INFO Generated: images/cc-by-nc-nd.svg
INFO Generated: images/avatar.gif
INFO Generated: images/cc-by-nc-sa.svg
INFO Generated: images/cc-by-nc.svg
INFO Generated: images/cc-by-nd.svg
INFO Generated: images/cc-by-sa.svg
INFO Generated: images/cc-by.svg
INFO Generated: images/cc-zero.svg
INFO Generated: images/favicon-16x16-next.png
INFO Generated: images/favicon-32x32-next.png
INFO Generated: images/loading.gif
INFO Generated: images/logo.svg
INFO Generated: images/placeholder.gif
INFO Generated: images/quote-l.svg
INFO Generated: images/quote-r.svg
INFO Generated: images/searchicon.png
INFO Generated: index.html
INFO Generated: lib/fastclick/LICENSE
INFO Generated: lib/algolia-instant-search/instantsearch.min.css
INFO Generated: lib/canvas-nest/canvas-nest.min.js
INFO Generated: lib/canvas-ribbon/canvas-ribbon.js
INFO Generated: lib/jquery_lazyload/CONTRIBUTING.html
INFO Generated: lib/needsharebutton/needsharebutton.css
INFO Generated: lib/pace/pace-theme-barber-shop.min.css
INFO Generated: lib/velocity/bower.json
INFO Generated: lib/fastclick/lib/fastclick.min.js
INFO Generated: lib/fancybox/source/helpers/jquery.fancybox-buttons.css
INFO Generated: lib/Han/dist/font/han-space.otf
INFO Generated: lib/fastclick/README.html
INFO Generated: lib/fastclick/bower.json
INFO Generated: lib/font-awesome/bower.json
INFO Generated: lib/jquery_lazyload/README.html
INFO Generated: lib/jquery_lazyload/bower.json
INFO Generated: lib/jquery_lazyload/jquery.lazyload.js
INFO Generated: lib/jquery_lazyload/jquery.scrollstop.js
INFO Generated: lib/pace/pace-theme-big-counter.min.css
INFO Generated: lib/pace/pace-theme-bounce.min.css
INFO Generated: lib/pace/pace-theme-center-atom.min.css
INFO Generated: lib/pace/pace-theme-center-circle.min.css
INFO Generated: lib/pace/pace-theme-center-radar.min.css
INFO Generated: lib/pace/pace-theme-center-simple.min.css
INFO Generated: lib/font-awesome/HELP-US-OUT.txt
INFO Generated: lib/pace/pace-theme-corner-indicator.min.css
INFO Generated: lib/pace/pace-theme-fill-left.min.css
INFO Generated: lib/pace/pace-theme-loading-bar.min.css
INFO Generated: lib/pace/pace-theme-flash.min.css
INFO Generated: lib/pace/pace-theme-mac-osx.min.css
INFO Generated: lib/pace/pace-theme-minimal.min.css
INFO Generated: lib/pace/pace.min.js
INFO Generated: lib/velocity/velocity.ui.min.js
INFO Generated: lib/fancybox/source/jquery.fancybox.css
INFO Generated: lib/fancybox/source/helpers/jquery.fancybox-buttons.js
INFO Generated: lib/fancybox/source/helpers/jquery.fancybox-media.js
INFO Generated: lib/fancybox/source/helpers/jquery.fancybox-thumbs.css
INFO Generated: lib/fancybox/source/helpers/jquery.fancybox-thumbs.js
INFO Generated: lib/three/canvas_lines.min.js
INFO Generated: lib/font-awesome/css/font-awesome.css
INFO Generated: lib/needsharebutton/needsharebutton.js
INFO Generated: lib/fancybox/source/jquery.fancybox.pack.js
INFO Generated: lib/fastclick/lib/fastclick.js
INFO Generated: lib/font-awesome/css/font-awesome.min.css
INFO Generated: lib/fancybox/source/helpers/fancybox_buttons.png
INFO Generated: 2021/02/22/hello-world/index.html
INFO Generated: js/src/schemes/pisces.js
INFO Generated: lib/ua-parser-js/dist/ua-parser.min.js
INFO Generated: css/main.css
INFO Generated: lib/needsharebutton/font-embedded.css
INFO Generated: lib/three/three-waves.min.js
INFO Generated: lib/velocity/velocity.min.js
INFO Generated: lib/velocity/velocity.ui.js
INFO Generated: lib/Han/dist/han.min.css
INFO Generated: lib/Han/dist/han.min.js
INFO Generated: lib/fancybox/source/jquery.fancybox.js
INFO Generated: lib/three/canvas_sphere.min.js
INFO Generated: js/src/affix.js
INFO Generated: lib/Han/dist/han.css
INFO Generated: lib/fancybox/source/fancybox_loading.gif
INFO Generated: lib/fancybox/source/[email protected]
INFO Generated: lib/fancybox/source/fancybox_overlay.png
INFO Generated: lib/fancybox/source/fancybox_sprite.png
INFO Generated: lib/fancybox/source/[email protected]
INFO Generated: lib/Han/dist/font/han-space.woff
INFO Generated: lib/Han/dist/font/han.woff2
INFO Generated: lib/fancybox/source/blank.gif
INFO Generated: js/src/algolia-search.js
INFO Generated: js/src/exturl.js
INFO Generated: js/src/hook-duoshuo.js
INFO Generated: js/src/bootstrap.js
INFO Generated: js/src/js.cookie.js
INFO Generated: js/src/motion.js
INFO Generated: js/src/post-details.js
INFO Generated: js/src/scroll-cookie.js
INFO Generated: js/src/scrollspy.js
INFO Generated: js/src/utils.js
INFO Generated: lib/ua-parser-js/dist/ua-parser.pack.js
INFO Generated: lib/jquery/index.js
INFO Generated: lib/Han/dist/han.js
INFO Generated: lib/font-awesome/css/font-awesome.css.map
INFO Generated: lib/Han/dist/font/han.otf
INFO Generated: lib/Han/dist/font/han.woff
INFO Generated: lib/font-awesome/fonts/fontawesome-webfont.woff
INFO Generated: lib/font-awesome/fonts/fontawesome-webfont.woff2
INFO Generated: lib/font-awesome/fonts/FontAwesome.otf
INFO Generated: 2021/02/22/deploy-hexo_next/index.html
INFO Generated: lib/font-awesome/fonts/fontawesome-webfont.eot
INFO Generated: lib/font-awesome/fonts/fontawesome-webfont.ttf
INFO Generated: lib/velocity/velocity.js
INFO Generated: lib/algolia-instant-search/instantsearch.min.js
INFO Generated: lib/font-awesome/fonts/fontawesome-webfont.svg
INFO Generated: lib/three/three.min.js
INFO 115 files generated in 2 s

关于静态页面生成时间 hexo静态页面生成时间还是很长的,这个跟文章数量、主题、分类、标签等等因素都有关系。如果文章数比较多的话,会等待很久。,几百上千文章数下,甚至要几个小时。有时候生成耗费几十分钟,然后报错,就要重新来过。发现生成过程只调用了cpu单核。调整机子的cpu核数,依旧只调用一个。hexo基于nodejs,而关于nodejs的cpu利用率,看看这个 [Node.js 多线程 —— worker_threads 初体验](https://blog.skk.moe/post/say-hello-to-nodejs-worker-thread/) ![Node.js 是「单线程」的吗?](https://bit-images.bj.bcebos.com/bit-new/file/20210223/pqtp.png)

启动hexo

1
hexo s
实机演示
1
2
3
4
5
6
7
8
9
10
11
12
13
[email protected]:~/hexo# hexo s
INFO Validating config
INFO Start processing
WARN ===============================================================
WARN ========================= ATTENTION! ==========================
WARN ===============================================================
WARN NexT repository is moving here: https://github.com/theme-next
WARN ===============================================================
WARN It's rebase to v6.0.0 and future maintenance will resume there
WARN ===============================================================
INFO Hexo is running at http://localhost:4000 . Press Ctrl+C to stop.


next主题默认页面

NexT首页设置文章预览

Preamble Text

在文章正文前添加预览介绍文字,用

1
<!-- more -->

与正文分割

NexT设置文字统计功能

Post Wordcount

在站点目录安装插件hexo-word-counter

1
2
npm install hexo-word-counter
hexo clean

在hexo配置文件中添加:

1
2
3
4
5
6
7
symbols_count_time:
symbols: true
time: true
total_symbols: true
total_time: true
awl: 4
wpm: 275

在next主题配置文件中修改:

1
2
3
4
symbols_count_time:
separated_meta: true
item_text_post: true
item_text_total: true

NexT设置文章阅读量统计功能

在next主题配置文件中修改:

1
2
3
4
5
6
7
8
busuanzi_count:
enable: true
total_visitors: true
total_visitors_icon: user
total_views: true
total_views_icon: eye
post_views: true
post_views_icon: eye

故障处理

访问web页面出现错误:

web报错
原因是hexo在5.0之后把swig给删除了需要自己手动安装

1
npm i hexo-renderer-swig

hexo g 静态页面生成报错

静态页面生成报错
原因是文件里有无法识别的符号组合,把无法识别的符号删去或者替换即可
>One possible reason is that there are some unrecognizable words in your file, e.g. invisible zero width characters.

关于静态页面生成时间

hexo静态页面生成时间还是很长的,这个跟文章数量、主题、分类、标签等等因素都有关系。
如果文章数比较多的话,会等待很久。几百上千文章数下,甚至要几个小时。有时候生成耗费几十分钟,然后报错,就要重新来过。之前有个项目要几万个markdown文件,这玩意直接废了。

类似案例

发现生成过程只调用了cpu单核。调整机子的cpu核数,依旧只调用一个。
hexo基于nodejs,而关于nodejs的cpu利用率,看看这个Node.js 多线程 —— worker_threads 初体验
Node.js 是「单线程」的吗?
hexo多核渲染
hexo多核渲染

  • 所以,怎么提高效率
    • 使用hugo代替,hugo和hexo使用方面类似,go语言的hugo比hexo快多了,上万的md还能凑合用,但是效率也不是最高的
    • 其他静态页面生成程序

hexo s 报错

1
2
3
4
5
(node:14301) Warning: Accessing non-existent property 'column' of module exports inside circular dependency
(node:14301) Warning: Accessing non-existent property 'filename' of module exports inside circular dependency
(node:14301) Warning: Accessing non-existent property 'lineno' of module exports inside circular dependency
(node:14301) Warning: Accessing non-existent property 'column' of module exports inside circular dependency
(node:14301) Warning: Accessing non-existent property 'filename' of module exports inside circular dependency

node版本问题,需要降低版本。
安装node版本管理模块n

1
sudo npm install n -g

降低到12.14版本

1
sudo n 12.14

next主题内容页下中文目录不跳转

编辑 主题配置文件\source\js\utils.js
在第236行加入

1
var target = document.getElementById(decodeURI(link.getAttribute('href')).replace('#', ''));

250行加入

1
return target;

注释掉第240行和第249行

1
//var target = document.getElementById(event.currentTarget.getAttribute('href').replace('#', ''));
1
//return document.getElementById(link.getAttribute('href').replace('#', ''));

示例如图
中文目录跳转示例

更多问题

hexo-Troubleshooting
iissnan-next-faqs
theme-next.js.org