REPORT

#一 Hexo博文自定义排序

使用的是top属性,top值越高,排序越在前,不设置top值得博文按照时间顺序排序。
修改Hexo文件夹下的node_modules/hexo-generator-index/lib/generator.js

打开在最后添加如下javascript代码
————————————————

posts.data = posts.data.sort(function(a, b) {
if(a.top && b.top) { // 两篇文章top都有定义
if(a.top == b.top) return b.date - a.date; // 若top值一样则按照文章日期降序排
else return b.top - a.top; // 否则按照top值降序排
}
else if(a.top && !b.top) { // 以下是只有一篇文章top有定义,那么将有top的排在前面(这里用异或操作居然不行233)
return -1;
}
else if(!a.top && b.top) {
return 1;
}
else return b.date - a.date;}) // 都没定义按照文章日期降序排

在写文章的时候添加top属性就行了。

#二 博客网站的基本设置

Site
Setting Description
title The title of your website
subtitle The subtitle of your website
description The description of your website
author Your name
language The language of your website. Use a 2-lettter ISO-639-1 code. Default is en.
timezone The timezone of your website. Hexo uses the setting on your computer by default.

Hexo支持配置如上站点参数,其中title属性就是博客的标题
打开站点配置文件_config.yml,找到如下配置项,配置成想要的值