0%

Hexo NexT主题配置

  • 主题:NexT 7.8.0

写在前面

装系统、下软件、改配置,这些操作每次都是重复的,但是每次都要重新去找,所以要记录一下。也顺便记录下每次的各种坑,和我的解决方案。为了尽量避免这些坑,我也会记录下每次操作的环境、版本、时间。所以搭建了这个博客,就从博客配置开始吧。

站点配置

站点配置文件地址 /themes/next/_config.yml

代码复制按钮

1
2
3
copy_button:
enable: true
show_result: true

页面加载进度条

1
2
pace:
enable: true

主题修改

1
2
3
4
5
# Schemes
# scheme: Muse
# scheme: Mist
# scheme: Pisces
scheme: Gemini

Next 主题修改 DOM 元素

在 themes/next/layout/_layout.swig 中,找到 </body>,在上面添加内容,可以使用正常 html 语法。
其他页面可以根据索引关系寻找,页面修改后需要重启 hexo server,才会生效。
vscode 推荐使用 Swig(.tpl) 插件,可以高亮显示 swig,格式化 swig。

Next 主题添加自定义样式

在 themes/next/source/css/_custom/custom.styl 中,添加自定义样式文件。
在 themes/next/source/css/main.styl 中,文件底部引入自定义样式。
vscode 推荐使用 Manta's Stylus Supremacy 插件,可以高亮显示 styl ,格式化 styl。

1
@import "_custom/style.styl";

注意:
编写 styl 文件时,背景图引入 base64 图片,博客所有样式会失效,我改成了 png 图片。

Next 主题添加自定义 JS

在 themes/next/source/js/custom.js 中,添加自定义 js 文件。
在 themes/next/layout/_scripts/index.swig 中引入 js 文件。

1
{{-next_js("custom.js");}}