Gamer's Show

你知道人生最要紧的事是快乐不停

0%

Hexo的Next美化教程

在这里放个官方教程的链接先
文中目录分为两类:site root directory指根目录,也就是点进你的hexo文件夹的第一个目录;Next directory指主题目录,也就是点进Next文件夹后的第一个目录。

自定义特征

界面

  1. favicon:将图标存储于hexo/source/images下,小图标为16*16,中等为32*32

设置

cc协定设置(creative commons)

1
2
3
4
5
6
creative_commons:
license: by-nc-sa
size: small
sidebar: true
post: true
language: deed.zh

页面

添加

在根目录下执行

1
$ hexo new page [custom-page-name]

设置

通过设置根目录下的_config.yml管理页面,注意如果path在上文已使用要删去或改成/

1
2
3
4
index_generator:
path: archives
per_page: 10
order_by: -date

分类与标签

tag和categories是相同的操作,改个名就可以,以下以tag为例

添加标签页

  1. 根目录下执行
    1
    hexo new page tags
  2. 编辑新页面index如下:
    1
    2
    3
    4
    title: Tags
    date: 2014-12-22 12:39:04
    type: tags
    ---
  3. 向next设置界面的menu中加入
    1
    tags: /tags/ || fa fa-tags
  4. 默认的hexo配置文件会与上方教程冲突,需要在根目录设置文件中将这个设置关闭
    1
    2
    tag_generator:
    enable_index_page: false

标签页美化

  1. 修改next设置文件
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    tagcloud:
    min: 12 # Minimun font size in px
    max: 20 # Maxium font size in px
    # 我喜欢小一点字所以设定的字偏小
    start: "#476D80"# Start color (hex, rgba, hsla or color keywords)
    end: "#98A9A3"# End color (hex, rgba, hsla or color keywords)
    #实际上是字体从小到大会有一个渐变,从start color变到end color,建议start颜色浅于end,会更好看一些,色系与主题周边色系相类似
    amount: 200 # Amount of tags, change it if you have more than 200 tags
    orderby: name # Order of tags
    order: 1 # Sort order

定义文章标签

在你文章标题下添加代码

1
tags: [Tag1,Tag2]

添加谷歌日历(Google Calendar)页

动态设置菜单栏

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
menu:
# 静态区
home: / || fa fa-home
archives: /archives/ || fa fa-archive
# 动态区
Docs: #动态栏名称
default: /docs/ || fa fa-book # 文件地址+图标,每个子菜单都需要一个默认界面
# 以下为两个子界面,排列在上方
Getting Started: #子界面名称,都是地址+标题
default: /getting-started/ || fa fa-flag
Installation: /installation.html || fa fa-download
Configuration: /configuration.html || fa fa-wrench
Third Party Plugins:
default: /third-party-services/ || fa fa-puzzle-piece
Math Equations: /math-equations.html || fa fa-square-root-alt
Comment Systems: /comments.html || fa fa-comment-alt

插件

Fancybox

展示音频,可以高度自定义的插件

1
fancybox: true

Busuanzi Counting(China)

将NexT设置文件中的相关按钮全打开,会在标题下显示本文总浏览量,页末显示网站的访问人数和浏览量

源代码美化

修改颜色

sidebar修改侧边栏字体颜色

next/source/css/_variables/主题名.styl下搜索sidebar
第一个是未选择项的颜色,第二个是鼠标高亮,第三个是选择高亮,我的设置如下:

1
2
3
$sidebar-nav-color                = #A9BACB;
$sidebar-nav-hover-color = #1e50a2;
$sidebar-highlight = #0482B5;

一些报错

hexo打开后页面一片空白

一开始的时候给我报错./soure/_data/header.swig中有一个变量不能调用,笨人看了同学的目录之后发现人家根本没这个文件夹…索性把这个文件夹删掉了,然后还是不行(但是不报错了),于是我去看了这个教程