Hexo系列(四) NexT主题配置
Hexo 框架允许我们更换合适的主题,以便于构建不同风格的网站,这里介绍目前最常使用的一款主题之一 —— NexT
一、NexT 安装
在正式开始讲解 NexT 安装之前,我们必须明确以下几个概念:
在使用 Hexo 框架建立的网站中,存在两份重要的配置文件,它们的文件名称都是 _config.yml
一份是 站点配置文件,位于 站点根目录 下,用于网站的基础配置
另外一份是 主题配置文件,位于 themes 目录 下,用于主题的相关配置
不同的主题会有不同的主题配置文件,由主题作者所提供
1、下载 NexT
在 站点根目录 中打开 git bash 窗口,使用如下命令下载 NexT 主题文件到 themes 目录 中
$ git clone https://github.com/iissnan/hexo-theme-next themes/next
Cloning into 'themes/next'...
remote: Counting objects: 12033, done.
remote: Total 12033 (delta 0), reused 0 (delta 0), pack-reused 12033
Receiving objects: 100% (12033/12033), 13.00 MiB | 1.37 MiB/s, done.
Resolving deltas: 100% (6991/6991), done.
Checking out files: 100% (351/351), done.
注意:如果出现以下错误
error: RPC failed; curl 18 transfer closed with outstanding read data remaining
fatal: The remote end hung up unexpectedly
fatal: early EOF
fatal: index-pack failed
请尝试使用以下命令
$ git clone git://github.com/iissnan/hexo-theme-next themes/next
2、启用 NexT
打开 站点配置文件, 将 theme
选项的值改为 next
,注意要在属性和值之间要加上一个空格
# Extensions
## Plugins: https://hexo.io/plugins/
## Themes: https://hexo.io/themes/
theme: next
此时,登陆自己的站点,应该可以看到更改已经成功
二、NexT 配置
1、设置 Scheme
Scheme 是用于 改变网站布局 的一个设置项,NexT 目前提供四种 Scheme:
Muse
:默认 Scheme,黑白主调,大量留白Mist
:Muse 的紧凑版本,整洁有序的单栏外观Pisces
:双栏 Scheme,小家碧玉的清新Gemini
:新增 Scheme
更改时,打开 主题配置文件,通过搜索关键字 Scheme Settings
定位,然后将使用的 scheme 打开注释即可
# ---------------------------------------------------------------
# Scheme Settings
# ---------------------------------------------------------------
# Schemes
#scheme: Muse
#scheme: Mist
scheme: Pisces
#scheme: Gemini
2、设置动态背景
更改时,打开 主题配置文件,通过搜索关键字 Canvas-nest
定位,然后将 canvas_nest
的值改成 true
即可
# Canvas-nest
canvas_nest: true
3、设置侧栏行为
默认情况下,侧栏仅在文章页面(拥有目录列表时)才显示,并放置于右侧位置
可以通过修改 主题配置文件 中的 Sidebar Settings
字段控制侧栏的行为
(1)侧栏位置:position
left
:靠左放置right
:靠右放置
(2)侧栏显示时机:display
post
:默认行为,在文章页面(拥有目录列表时)显示always
:在所有页面中都显示hide
:在所有页面中都隐藏remove
:完全移除
# Sidebar Position, available value: left | right (only for Pisces | Gemini).
position: left
#position: right
# Sidebar Display, available value (only for Muse | Mist):
# - post expand on posts automatically. Default.
# - always expand for all pages automatically
# - hide expand only when click on the sidebar toggle icon.
# - remove Totally remove sidebar including sidebar toggle.
display: post
#display: always
#display: hide
#display: remove
4、设置菜单
(1)设置菜单项
打开 主题配置文件,搜索关键字 Menu Settings
进行定位,各个菜单项通过 # 注释开启或关闭
# ---------------------------------------------------------------
# Menu Settings
# ---------------------------------------------------------------
# When running the site in a subdirectory (e.g. domain.tld/blog), remove the leading slash from link value (/archives -> archives).
# Usage: `Key: /link/ || icon`
# Key is the name of menu item. If translate for this menu will find in languages - this translate will be loaded; if not - Key name will be used. Key is case-senstive.
# Value before `||` delimeter is the target link.
# Value after `||` delimeter is the name of FontAwesome icon. If icon (with or without delimeter) is not specified, question icon will be loaded.
menu:
home: / || home
#about: /about/ || user
#tags: /tags/ || tags
categories: /categories/ || th
archives: /archives/ || archive
#schedule: /schedule/ || calendar
#sitemap: /sitemap.xml || sitemap
#commonweal: /404/ || heartbeat
部分菜单项的功能描述如下:
home
:主页about
:关于tags
:标签categories
:分类archives
:归档
(2)创建文件夹
这里演示创建 categories 分类页面的文件夹,其它菜单项的添加类似
在 站点根目录 下,打开 git bash,输入命令 $ hexo new page "categories"
$ hexo new page "categories"
INFO Created: C:\Desktop\test\source\categories\index.md
(3)添加文档头部
这里演示添加 categories 分类页面的文档头部,其它菜单项的添加类似
打开新建的 index.md
文件,在 文档头部 添加以下描述:
---
title: categories
date: 2015-12-04 15:37:22
type: "categories"
comments: false
---
5、设置头像
打开 主题配置文件, 搜索关键字 Sidebar Avatar
进行定位,将 avatar
的值设置成头像图片的链接地址即可
# Sidebar Avatar
# in theme directory(source/images): /images/avatar.gif
# in site directory(source/uploads): /uploads/avatar.gif
avatar: <url>
头像图片的链接地址可以是:
- 完整的互联网地址:例如,https://www.example.com/avatar.jpg
- 站点内的相对地址:例如,假设图片命名为 avatar.jpg,存放在 source/images/ 目录下,则链接地址可以写成 /images/avatar.jpg
6、添加社交链接
打开 主题配置文件,搜索关键字 Social Links
进行定位,social
的值按 Key: permalink || icon
格式设置
# Social Links.
# Usage: `Key: permalink || icon`
# Key is the link label showing to end users.
# Value before `||` delimeter is the target permalink.
# Value after `||` delimeter is the name of FontAwesome icon. If icon (with or without delimeter) is not specified, globe icon will be loaded.
social:
GitHub: https://github.com/Forwhfang || Github
CSDN: https://blog.csdn.net/wsmrzx || CSDN
cnblogs: https://www.cnblogs.com/wsmrzx || cnblogs
7、添加文字统计功能
进入 站点根目录,打开 git bash 窗口,输入如下命令安装插件
$ npm install hexo-wordcount --save
然后打开 主题配置文件,进行如下配置
# Post wordcount display settings
# Dependencies: https://github.com/willin/hexo-wordcount
post_wordcount:
item_text: true
wordcount: true
min2read: true
totalcount: true
separated_meta: true
8、添加阅读量统计功能
在 主题配置文件 中修改 busuanzi_count
字段启用不蒜子统计功能
# Show PV/UV of the website/page with busuanzi.
# Get more information on http://ibruce.info/2015/04/04/busuanzi/
busuanzi_count:
# count values only if the other configs are false
enable: true
# custom uv span for the whole site
site_uv: true
site_uv_header: <i class="fa fa-user"></i>
site_uv_footer:
# custom pv span for the whole site
site_pv: true
site_pv_header: <i class="fa fa-eye"></i>
site_pv_footer:
# custom pv span for one page only
page_pv: true
page_pv_header: <i class="fa fa-file-o"></i>
page_pv_footer:
【参考资料】
【Hexo系列相关文章】
Hexo系列(四) NexT主题配置的更多相关文章
- Hexo+NexT(四):Hexo站点及Next主题配置详解
采用Hexo及NexT搭建好网站以后,有些效果不是我们需要的,Hexo及NexT提供了强大的定制功能,本文章将要讲解的就是如何在对网站进行配置及调整,达到博主需要的效果. 本文章配置环境是Hexo 3 ...
- Redis系列四 Redis常见配置
redis.conf常见配置 参数说明redis.conf 配置项说明如下:1. Redis默认不是以守护进程的方式运行,可以通过该配置项修改,使用yes启用守护进程 daemonize no2. ...
- Hexo系列(五) 撰写文章
在利用 Hexo 框架搭建一个属于我们自己的博客网站后,下面我们就来谈谈怎样在网站上书写我们的第一篇博客吧 一.创建文章 在站点文件夹中打开 git bash,输入如下命令创建文章,其中 title ...
- Hexo系列(三) 常用命令详解
Hexo 框架可以帮助我们快速创建一个属于自己的博客网站,熟悉 Hexo 框架提供的命令有利于我们管理博客 1.hexo init hexo init 命令用于初始化本地文件夹为网站的根目录 $ he ...
- Hexo系列(二) 配置文件详解
Hexo 是一款优秀的博客框架,在使用 Hexo 搭建一个属于自己的博客网站后,我们还需要对其进行配置,使得 Hexo 更能满足自己的需求 这里所说的配置文件,是位于站点根目录下的 _config.y ...
- Hexo系列(一) 搭建博客网站
写在前面的话:本系列文章主要参考 Hexo官方说明文档,同时结合自己在使用过程中的一些心得体会,撷取下来,和大家分享分享.好,下面闲话不多说,马上开始我们的 Hexo 之旅吧 温馨提醒:博主使用的操作 ...
- 使用react全家桶制作博客后台管理系统 网站PWA升级 移动端常见问题处理 循序渐进学.Net Core Web Api开发系列【4】:前端访问WebApi [Abp 源码分析]四、模块配置 [Abp 源码分析]三、依赖注入
使用react全家桶制作博客后台管理系统 前面的话 笔者在做一个完整的博客上线项目,包括前台.后台.后端接口和服务器配置.本文将详细介绍使用react全家桶制作的博客后台管理系统 概述 该项目是基 ...
- Hexo的Next主题配置
使用Next主题 在这里Downloads Next主题代码 将下载的代码放在myBlog/next目录下 设置站点myBlog/_config.yml的theme字段值为next 生成新页面hexo ...
- 安装配置hexo icarus主题配置
安装部分配置hexo icarus主题配置 安装icarus 直接下载主题模块放到blog项目 ,blog项目根目录执行 git clone https://github.com/ppoffice/h ...
随机推荐
- Swift基础(类,结构体,函数)
import Foundation // 创建一个类 class Student { // 属性(类的属性必须赋初值,如果不赋值,需要写自定义方法) var studentName: String v ...
- hdu 1050 Moving Tables(迷之贪心...)
题意:有400间房间按题目中图片所给的方式排列,然后给出要移动的n张桌子所要移动的范围,每张桌子要移动的范围不能出现重叠的区域:问最少要多少次才能移动完所有的桌子. 题解思路:把题目转换下,就是有n个 ...
- POJ2417 Baby-Step-Gaint-Step 算法
考虑一个问题:A^x%p=B,给定A,B,p,求x的最小非负整数解. 在p是质数的情况下,这个问题比較简单. A^x=B(mod P) (P is a Prime, A,B<P) Let m = ...
- BeanUtils使用案例
1.BeanUtils框架/工具(APACHE开源组织开发) (1)BeanUtils框架可以完毕内省的一切功能.并且优化 (2)BeanUtils框架可以对String<-> ...
- Linux vs Window
目前国内Linux更多的是应用于服务器上,而桌面操作系统更多使用的是Window.主要区别如下: 比较 Windows Linux 界面 界面统一,外壳程序固定所有Windows程序菜单几乎一致,快捷 ...
- luogu2331 [SCOI2005]最大子矩阵
题目大意 这里有一个n*m的矩阵,请你选出其中k个子矩阵,使得这个k个子矩阵分值之和最大.注意:选出的k个子矩阵不能相互重叠.1≤n≤100,1≤m≤2,1≤k≤10. 思路 #include < ...
- poj 1840(五元三次方程组)
Description Consider equations having the following form: a1x1 3+ a2x2 3+ a3x3 3+ a4x4 3+ a5x5 3=0 T ...
- zoj--3870--Team Formation(位运算好题)
Team Formation Time Limit: 3000MS Memory Limit: 131072KB 64bit IO Format: %lld & %llu Submit ...
- go之for循环
一.基于计数器的迭代 格式 for 初始化语句; 条件语句; 修饰语句{} 实例 package main import "fmt" func main(){ for i:=0;i ...
- IP地址库
吐槽 前两天一个线上的IP地址库除了点幺蛾子,一查代码,发现用的库早就不更新了,遂决定换库,有几个方案: 纯真数据库 IPIP数据库 GeoIP 纯真数据库是大码农的福音,免费,但是精度一般:IPIP ...