【Hexo】NexT 主题的配置使用记录
简介
NexT 主题是 Hexo 上使用最广,同时在 GitHub 上也是 Star 最多的主题,bug 修复和功能更新也比较快。当前博客就是使用 Hexo 配合 NexT 主题搭建的
版本
在 【必读】更新说明及常见问题 中有相关说明,NexT 一共有三个不同的仓库:
| 版本 | 年份 | 仓库 |
|---|---|---|
| v5.1.4 或更低 | 2014 ~ 2017 | iissnan/hexo-theme-next |
| v6.0.0 ~ v7.8.0 | 2018 ~ 2019 | theme-next/hexo-theme-next |
| v8.0.0 或更高 | 2020 | next-theme/hexo-theme-next |
旧的仓库基本上已经不再更新,因此推荐选择最新的 next-theme/hexo-theme-next 仓库的 NexT 主题
安装
推荐使用 GitHub 进行安装,可以随时更新
因为笔者个人在 Windows 环境下写博客,后续命令均以 PowerShell 为例
cd <hexo-dir>
# git clone https://github.com/next-theme/hexo-theme-next.git .\themes\next\
git clone git@github.com:next-theme/hexo-theme-next.git
cp .\themes\next\_config.yml .\_config.next.yml
配置记录
对 NexT 主题的配置可以直接在 hexo 仓库下的配置文件 _config.next.yml 中进行修改即可,该文件的修改会在生成页面时覆盖主题目录下的配置文件 .\themes\next\_config.yml
衍生拓展:【Hexo】配置文件优先级
风格/主题
NexT 主题包含了 4 个风格,个人喜欢 Gemini,类似卡片的风格,边界比较明显

修改 _config.next.yml 之后,用 hexo clean; hexo g; hexo s 重新生成一下,就可以在 本地 预览了(后续流程如果没有特殊说明则基本一致)
# Schemes
# scheme: Muse
# scheme: Mist
# scheme: Pisces
scheme: Gemini
网页图标
在各类网站上下载合适图标,按照配置文件中的文件名命名,并放在 images 下即可
衍生阅读:【Apple】Configuring Web Applications
favicon:
small: /images/favicon-16x16-next.png
medium: /images/favicon-32x32-next.png
apple_touch_icon: /images/apple-touch-icon-next.png
safari_pinned_tab: /images/logo.svg
#android_manifest: /manifest.json
菜单栏
菜单栏配置默认没有开启,个人开启了 首页、标签、分类、归档 四个子项目,并开启了图标和数量的气泡显示
# Usage: `Key: /link/ || icon`
# Key is the name of menu item. If the translation for this item is available, the translated text will be loaded, otherwise the Key name will be used. Key is case-sensitive.
# Value before `||` delimiter is the target link, value after `||` delimiter is the name of Font Awesome icon.
# External url should start with http:// or https://
menu:
home: / || fa fa-home
#about: /about/ || fa fa-user
tags: /tags/ || fa fa-tags
categories: /categories/ || fa fa-th
archives: /archives/ || fa fa-archive
#schedule: /schedule/ || fa fa-calendar
#sitemap: /sitemap.xml || fa fa-sitemap
#commonweal: /404/ || fa fa-heartbeat
# Enable / Disable menu icons / item badges.
menu_settings:
icons: true
badges: true
侧边栏
默认头像会开启旋转功能,花里胡哨的而且旋转有点快,个人选择了关闭
# Sidebar Avatar
avatar:
# Replace the default image and set the url here.
url: /images/avatar.gif
# If true, the avatar will be displayed in circle.
rounded: true
# If true, the avatar will be rotated with the cursor.
rotated: false
在单独的文章页面时侧边栏会默认显示为目录,并且 标签、分类、归档 已经在菜单栏开启了,所以个人选择了关闭
# Posts / Categories / Tags in sidebar.
site_state: false
其他社交网站的主页的配置起来也很简单,简单替换一下链接,并且取消注释即可
# Social Links
# Usage: `Key: permalink || icon`
# Key is the link label showing to end users.
# Value before `||` delimiter is the target permalink, value after `||` delimiter is the name of Font Awesome icon.
social:
GitHub: https://github.com/ywang-wnlo || fab fa-github
E-Mail: mailto:ywang_wnlo@qq.com || fa fa-envelope
#Weibo: https://weibo.com/yourname || fab fa-weibo
#Google: https://plus.google.com/yourname || fab fa-google
#Twitter: https://twitter.com/yourname || fab fa-twitter
#FB Page: https://www.facebook.com/yourname || fab fa-facebook
#StackOverflow: https://stackoverflow.com/yourname || fab fa-stack-overflow
#YouTube: https://youtube.com/yourname || fab fa-youtube
#Instagram: https://instagram.com/yourname || fab fa-instagram
#Skype: skype:yourname?call|chat || fab fa-skype
本地搜索
本地搜索可以快速的检索所有的文章,有时候还是很有用的
配置本地搜索之前,首先要在 hexo 下安装插件
npm install hexo-generator-searchdb --save
然后在配置中开启即可
# Local Search
# Dependencies: https://github.com/next-theme/hexo-generator-searchdb
local_search:
enable: true
# If auto, trigger search by changing input.
# If manual, trigger search by pressing enter key or search button.
trigger: auto
# Show top n results per article, show all results by setting to -1
top_n_per_article: -1
# Unescape html strings to the readable one.
unescape: true
# Preload the search data when the page loads.
preload: false
代码块
代码块的高亮有很多种配色可以选,并且可以开启一键复制功能
codeblock:
# Code Highlight theme
# All available themes: https://theme-next.js.org/highlight/
theme:
light: vs
dark: vs2015
prism:
light: prism
dark: prism-dark
# Add copy button on codeblock
copy_button:
enable: true
# Available values: default | flat | mac
style: default
动画效果
NexT 默认开启了动画效果,但是感觉比较慢,感觉有些影响阅读,推荐开启 async,并且适当的修改动画效果
PS. 菜单栏的动画不可以关闭和调整,应该是个 bug
# Use Animate.css to animate everything.
# For more information: https://animate.style
motion:
enable: true
async: true
transition:
# All available transition variants: https://theme-next.js.org/animate/
post_block: fadeIn
post_header:
post_body:
coll_header:
# Only for Pisces | Gemini.
sidebar: fadeInDown
阅读进度
阅读进度有两种展示方式,一个在回到首页的按钮上直接显示百分比,另一个可以配置在首位部增加进度条,个人两个都开启了
back2top:
enable: true
# Back to top in sidebar.
sidebar: false
# Scroll percent label in b2t button.
scrollpercent: true
# Reading progress bar
reading_progress:
enable: true
# Available values: left | right
start_at: left
# Available values: top | bottom
position: bottom
reversed: false
color: "#37c6c0"
height: 5px
书签
NexT 的书签功能可以保存当前的阅读进度,下次打开是会在续接该进度
# Bookmark Support
bookmark:
enable: true
# Customize the color of the bookmark.
color: "#222"
# If auto, save the reading progress when closing the page or clicking the bookmark-icon.
# If manual, only save it by clicking the bookmark-icon.
save: auto
Mermaid
Mermaid 可以快速的用代码生成简单的流程图、时序图、甘特图等
NexT 中开启 Mermaid 支持很方便,同时还有不同的风格可以选
# Mermaid tag
mermaid:
enable: true
# Available themes: default | dark | forest | neutral
theme:
light: neutral
dark: dark
lazyload
lazyload 是网站常用的技术,通过按需加载,避免一次性加载过多内容导致的打开缓慢
# Vanilla JavaScript plugin for lazyloading images.
# For more information: https://apoorv.pro/lozad.js/demo/
lazyload: true
fancybox
fancybox 可以在点击图片时放大该图片,并且可以快速浏览当前文章的所有图片
# FancyBox is a tool that offers a nice and elegant way to add zooming functionality for images.
# For more information: https://fancyapps.com/fancybox/
fancybox: true
pangu
对于强迫症来说,中英文混排时加上空格能很大程度改善阅读体验,但是有时候会不小心打漏部分空格,而 pangu 这个项目就可以帮你在展示时自动加上空格
# Pangu Support
# For more information: https://github.com/vinta/pangu.js
# Server-side plugin: https://github.com/next-theme/hexo-pangu
pangu: true
捐赠
文章末尾还可以求打赏,需要配置好相应的二维码图片,并且可以修改提示语句
# Donate (Sponsor) settings
# Front-matter variable (nonsupport animation).
reward_settings:
# If true, a donate button will be displayed in every article by default.
enable: true
animation: false
comment: 赏个鸡腿
reward:
wechatpay: /images/wechatpay.png
alipay: /images/alipay.jpg
#paypal: /images/paypal.png
#bitcoin: /images/bitcoin.png
版权声明
NexT 内置了文章末尾增加版权声明,只需手动开启即可
# Creative Commons 4.0 International License.
# See: https://creativecommons.org/about/cclicenses/
creative_commons:
# Available values: by | by-nc | by-nc-nd | by-nc-sa | by-nd | by-sa | cc-zero
license: by-nc-sa
# Available values: big | small
size: small
sidebar: false
post: true
# You can set a language value if you prefer a translated version of CC license, e.g. deed.zh
# CC licenses are available in 39 languages, you can find the specific and correct abbreviation you need on https://creativecommons.org
language:
不蒜子
不蒜子 是一个极简的网页计数器,NexT 已经内置,只需打开即可
# Show Views / Visitors of the website / page with busuanzi.
# For more information: http://ibruce.info/2015/04/04/busuanzi/
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
gitalk
评论系统也是一个博客必不可少的,由于本博客搭在 GitHub Pages 上,所以评论系统就采用利用 GitHub Issues 实现的 gitalk
NexT 已经内置的 gitalk 的 js 和 css,在配置文件中开启并进行配置即可
在修改配置文件之前需要先在 GitHub 上申请一个 OAuth
Application,入口在 【Settings】 -> 【Developer settings】 -> 【OAuth Apps】 -> 【New OAuth App】,或者直接使用这个 链接

填写好之后,记录下应用 id 以及密钥,如果没有显示密钥需要手动生成一下

然后首先选用 gitalk 作为评论系统
# Multiple Comment System Support
comments:
# Available values: tabs | buttons
style: tabs
# Choose a comment system to be displayed by default.
# Available values: disqus | disqusjs | changyan | livere | gitalk | utterances
active: gitalk
# Setting `true` means remembering the comment system selected by the visitor.
storage: true
# Lazyload all comment systems.
lazyload: true
# Modify texts or order for any naves, here are some examples.
nav:
#disqus:
# text: Load Disqus
# order: -1
#gitalk:
# order: -2
在 gitalk 配置中填上相应的内容
# Gitalk
# For more information: https://gitalk.github.io
gitalk:
enable: true
github_id: <GitHub id> # GitHub repo owner
repo: <GitHub id>.github.io # Repository name to store issues
client_id: <应用 id> # GitHub Application Client ID
client_secret: <应用密钥> # GitHub Application Client Secret
admin_user: <GitHub id> # GitHub repo owner and collaborators, only these guys can initialize gitHub issues
distraction_free_mode: true # Facebook-like distraction free mode
# When the official proxy is not available, you can change it to your own proxy address
proxy: https://cors-anywhere.azm.workers.dev/https://github.com/login/oauth/access_token # This is official proxy address
# Gitalk's display language depends on user's browser or system environment
# If you want everyone visiting your site to see a uniform language, you can set a force language value
# Available values: en | es-ES | fr | ru | zh-CN | zh-TW
language:
参考资料
- 【NexT】v8.0.0+ 官网
- 【必读】更新说明及常见问题
- 【Hexo】配置文件优先级
- 【Apple】Configuring Web Applications
- 【Mermaid】官网
- 【GitHub】pangu
- 【不蒜子】官网
- 【GitHub】Gitalk
本文作者: ywang_wnlo
本文链接: https://ywang-wnlo.github.io/posts/9a0b7c3b.html
版权声明: 本博客所有文章除特别声明外,均采用 BY-NC-SA 许可协议。转载请注明出处!
【Hexo】NexT 主题的配置使用记录的更多相关文章
- HEXO & CARDS主题进阶配置
我想对于建立一个网站而言,第一步要能够做到正常在线访问以及定期产出一定的内容, 其实当网站建立好那一刻,这第一步已经算是完成了,不过我在此基础之上做了些扩展 在默认的card主题之上,我设置了标签.分 ...
- Hexo搭建个人博客及next主题基本配置
前言 国内一些免费的博客平台比如CSDN.博客园都已经很成熟,功能齐全,已经可以满足我们的需求,帮助我们记录学习过程遇到的问题,还能分享帮助其他人解决问题.为什么还要自己动手去搭建博客呢?首先写博客是 ...
- 安装配置hexo icarus主题配置
安装部分配置hexo icarus主题配置 安装icarus 直接下载主题模块放到blog项目 ,blog项目根目录执行 git clone https://github.com/ppoffice/h ...
- hexo next主题为博客添加分享功能
title: hexo next主题为博客添加分享功能 date: 2018-01-06 20:20:02 tags: [hexo博客, 博客配置] categories: hexo next主题配置 ...
- Hexo next主题下添加天气插件
最近在优化hexo 新搭建的博客,想给博客添加一个天气插件,奈何找了很久也没发现,好不容易发现一个天气插件 心知天气:https://www.seniverse.com/widget/get 运气不好 ...
- hexo多主题切换
今天看到一个朋友在github上面的issue 大概问题就是怎么在不同的电脑上面使用 git有个这么个东西Submoudle中文叫做子模块 具体使用教程看这里Git-工具-子模块 这里只说怎么搞hex ...
- hexo next主题深度优化(一),加入pjax功能。
文章目录 背景: 进入正题 pjax初体验--instantclick 真正的pjax 第一步 第二步 第三步 第四步 专门基于hexo next主题的pjax(将丢失的js效果重现) 将下面讲到的提 ...
- hexo next主题深度优化(五),评论系统换成gittalk
文章目录 背景: 开始: 新建comments_git.js 找到comments.swig在最后一个endif之前 引入代码 pjax加入gitalk 遇到的问题 所有的页面共享的一个评论issue ...
- hexo next主题深度优化(二),懒加载。
文章目录 tip:没有耐心的可以直接看:正式在hexo next中加入懒加载(最下面) 废话 背景 懒加载简单介绍 引入js 重点!敲黑板了!!! 完善懒加载函数 懒加载函数可配置的参数 正式在hex ...
- Hexo next主题安装algolia
一直在使用hexo写自己的博客,最近博客刚刚搬家重新搞了下博客: 1.为hexo添加站内搜索 我用的是algolia,在next主题5.x以上的版本集成了algolia站内搜索功能,我们只需要简单的配 ...
随机推荐
- POJ - 2251 地下城主
You are trapped in a 3D dungeon and need to find the quickest way out! The dungeon is composed of un ...
- flutter系列之:做一个下载按钮的动画
目录 简介 定义下载的状态 定义DownloadButton的属性 让DownloadButton的属性可以动态变化 定义downloadController 定义DownloadButton的细节 ...
- Spring boot+vue打包、上传宝塔面板并配置https
终于把网站搞完了,也终于能够通过域名访问了,这次就简单回顾一下这么多时间的经历,总结一下. 项目地址穆音博客,本文发布原地址在Spring boot+vue打包.上传宝塔面板并配置https 我的开发 ...
- MassTransit实现Saga模式概览
原文地址:Saga Overview 编排一系列事件的能力是一个强大的功能,而MassTransit使这成为可能. saga是由协调器管理的长期事务.saga是由事件发起的,saga编排事件,saga ...
- Hugging News #0602: Transformers Agents 介绍、大语言模型排行榜发布!
每一周,我们的同事都会向社区的成员们发布一些关于 Hugging Face 相关的更新,包括我们的产品和平台更新.社区活动.学习资源和内容更新.开源库和模型更新等,我们将其称之为「Hugging Ne ...
- .Net Core后端架构实战【3-介入IOC控制反转】
摘要:基于.NET Core 7.0WebApi后端架构实战[2-介入IOC控制反转] 2023/04/09, ASP.NET Core 7.0, VS2022 引言 Inversion of Co ...
- 沉思篇-剖析Jetpack的LiveData
上一篇我们讲到了架构组件中的Lifecycle,由于缺少具体的运用,可能缺少直观的感受,今天我们就用Lifecycle实战一回,看看Lifecycle是怎样运用到LiveData中的. LiveDat ...
- 利用生成式预训练Transformer实现智能问答与人机交互
目录 利用生成式预训练Transformer实现智能问答与人机交互 随着人工智能技术的不断发展,智能问答和人机交互已经成为了人工智能领域中的重要研究方向.在智能问答中,机器能够以自然的方式与人类进行对 ...
- Redis基础(二)——列表操作、redis管道、Django中使用redis
Redis列表操作 ''' lpush(name,values) rpush(name, values) 表示从右向左操作 lpushx(name,value) rpushx(name, value) ...
- qrcode模块生成二维码
安装qrcode模块 pip install qrcode 简单使用 import qrcode data = 'hello world' img = qrcode.make(data) # 显示二维 ...