博文压缩
在站点根目录下执行以下命令:
1 | $ npm install gulp -g |
在根目录下新建gulpfile.js
,并填入以下内容
1 | var gulp = require('gulp'); |
生成博文是执行 hexo g && gulp
就会根据 gulpfile.js
中的配置,对 public 目录中的静态资源文件进行压缩。
添加顶部加载条
升级最新的next主题,只需修改主题配置文件_config.yml
,pace: false
改为pace: true
即可,还可以选择不同样式的加载条。
修改标签图标
修改模板/themes/next/layout/_macro/post.swig
,搜索 rel="tag">#
,将 # 换成<i class="fa fa-tag"></i>
点击出现桃心效果
在/themes/next/source/js/src
下新建love.js
,写入以下内容
1 | !function(e,t,a){function n(){c(".heart{width: 10px;height: 10px;position: fixed;background: #f00;transform: rotate(45deg);-webkit-transform: rotate(45deg);-moz-transform: rotate(45deg);}.heart:after,.heart:before{content: '';width: inherit;height: inherit;background: inherit;border-radius: 50%;-webkit-border-radius: 50%;-moz-border-radius: 50%;position: fixed;}.heart:after{top: -5px;}.heart:before{left: -5px;}"),o(),r()}function r(){for(var e=0;e<d.length;e++)d[e].alpha<=0?(t.body.removeChild(d[e].el),d.splice(e,1)):(d[e].y--,d[e].scale+=.004,d[e].alpha-=.013,d[e].el.style.cssText="left:"+d[e].x+"px;top:"+d[e].y+"px;opacity:"+d[e].alpha+";transform:scale("+d[e].scale+","+d[e].scale+") rotate(45deg);background:"+d[e].color+";z-index:99999");requestAnimationFrame(r)}function o(){var t="function"==typeof e.onclick&&e.onclick;e.onclick=function(e){t&&t(),i(e)}}function i(e){var a=t.createElement("div");a.className="heart",d.push({el:a,x:e.clientX-5,y:e.clientY-5,scale:1,alpha:1,color:s()}),t.body.appendChild(a)}function c(e){var a=t.createElement("style");a.type="text/css";try{a.appendChild(t.createTextNode(e))}catch(t){a.styleSheet.cssText=e}t.getElementsByTagName("head")[0].appendChild(a)}function s(){return"rgb("+~~(255*Math.random())+","+~~(255*Math.random())+","+~~(255*Math.random())+")"}var d=[];e.requestAnimationFrame=function(){return e.requestAnimationFrame||e.webkitRequestAnimationFrame||e.mozRequestAnimationFrame||e.oRequestAnimationFrame||e.msRequestAnimationFrame||function(e){setTimeout(e,1e3/60)}}(),n()}(window,document); |
打开\themes\next\layout\_layout.swig
文件,在末尾添加:<script type="text/javascript" src="/js/src/love.js"></script>
设置个人头像
在主题配置文件中找到avatar
字段进行修改:avatar: /images/head_icon.jpg
或者url地址。
设置头像动态特效
在themes\next\layout\_partials\head.swig
打开,末尾添加如下字段:<link href="//cdn.bootcss.com/animate.css/3.5.0/animate.min.css" rel="stylesheet">
打开themes\next\source\css\_common\components\sidebar\sidebar-author.styl
,添加如下语句
1 | .site-author-image:hover { |
可以在这里找到喜欢的特效,替换jello
显示每篇文章的字数
安装插件 npm install hexo-wordcount --save
修改主题配置文件,定位post_wordcount
,修改wordcount
为true
。
显示站点总字数
安装插件方法如上
修改totalcount
为true
设置博文内链接为蓝色
打开文件vim themes/next/source/css/_common/components/post/post.styl
在文件中添加如下字段:
1 | .post-body p a{ |