参考:
hexo的next主题个性化配置 - 知乎 (zhihu.com)
Hexo+Next主题的一些实用插件和美化升级_next 单行代码 美观优化_小王同学w的博客-CSDN博客
1.配置修改 (1)取消目录章节自动编号 修改配置文件 ./themes/next/_config.yml
1 2 3 4 5 6 toc: enable: true number: true wrap: false expand_all: false max_depth: 6
(2)网站图标 修改配置文件 ./themes/next/_config.yml
1 2 3 4 5 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
favicon-nxn-next.png 均位于 ./themes/next/source/images目录
(3)代码块复制功能 修改配置文件 ./themes/next/_config.yml
1 2 3 4 5 6 7 codeblock: ... copy_button: enable: false style:
(4)侧边栏社交链 修改配置文件 ./themes/next/_config.yml
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 social: GitHub: https://github.com/WilsonGoGo || fab fa-github E-Mail: mailto:[email protected] || fa fa-envelope social_icons: enable: true icons_only: false transition: false GitHub: github E-Mail: envelope social: GitHub: https://github.com/zzwwqq || github E-Mail: mailto:[email protected] || envelope Weibo: https://weibo.com/u/5564810309/home?wvr=5 || weibo 知乎: https://www.zhihu.com/people/shen-qiu-wu-hen-66/activities || snapchat social_icons: enable: true icons_only: false transition: false GitHub: github E-Mail: envelope Weibo: weibo 知乎: snapchat
(4)站点浏览次数(未生效,插件未安装) 修改主题配置文件 ./themes/next/_config.yml
1 2 3 4 5 6 7 8 9 10 busuanzi_count: enable: false 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
注:该模块具体html代码设置已在./themes/next/layout/_partials/footer.njk文件中,但是可以通过主题配置文件中配置开选择是否启用相关代码
(5)评论系统+文章阅读次数(未实现,需要leancloud账号) 2.布局修改 (1)Fork me on github标签 在./themes/next/layout/_layout.njk文件中进行配置
1 2 3 4 5 6 7 <body itemscope itemtype ="http://schema.org/WebPage" {% if theme.motion.enable %} class ="use-motion" {% endif %}> <div class ="headband" > </div > <a href ="https://github.com/WilsonGoGo" ... > ...
需要插入的该行代码可由以下网址生成
GitHub Ribbons | The GitHub Blog
GitHub Corners (tholman.com)
(2)站点运行时长 在 ./themes/next/layout/_partials/footer.njk文件底部添加下面的代码
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 <div > <span id ="timeDate" > 载入天数...</span > <span id ="times" > 载入时分秒...</span > <script > var now = new Date (); function createtime ( ) { var start_time_string = '2022-09-14 14:43:26' ; var grt = new Date (start_time_string.replace (/-/g , "/" )); now.setTime (now.getTime ()+1000 ); days = (now - grt ) / 1000 / 60 / 60 / 24 ; dnum = Math .floor (days); hours = (now - grt ) / 1000 / 60 / 60 - (24 * dnum); hnum = Math .floor (hours); if (String (hnum).length ==1 ){hnum = "0" + hnum;} minutes = (now - grt ) / 1000 /60 - (24 * 60 * dnum) - (60 * hnum); mnum = Math .floor (minutes); if (String (mnum).length ==1 ){mnum = "0" + mnum;} seconds = (now - grt ) / 1000 - (24 * 60 * 60 * dnum) - (60 * 60 * hnum) - (60 * mnum); snum = Math .round (seconds); if (String (snum).length ==1 ){snum = "0" + snum;} document .getElementById ("timeDate" ).innerHTML = "本站已安全运行 " +dnum+" 天 " ; document .getElementById ("times" ).innerHTML = hnum + " 小时 " + mnum + " 分 " + snum + " 秒" ; } setInterval ("createtime()" ,1000 ); </script > </div >
3.网站特效 (1)鼠标点击特效(未实现) (2)博客宠物(未实现) (3)作者头像动画(未实现) 打开.\themes\next\source\css\_common\components\sidebar\sidebar-author.styl,添加代码
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 .site-author-image { display : block; margin : 0 auto; padding : $site -author-image-padding; max-width : $site -author-image-width; height : $site -author-image-height; border : $site -author-image-border-width solid $site -author-image-border-color; border-radius : 80px ; -webkit-border-radius : 80px ; -moz-border-radius : 80px ; box-shadow : inset 0 -1px 0 #333s f; -webkit-transition : -webkit-transform 1.0s ease-out; -moz-transition : -moz-transform 1.0s ease-out; transition : transform 1.0s ease-out; } img :hover { -webkit-transform : rotateZ (360deg ); -moz-transform : rotateZ (360deg ); transform : rotateZ (360deg ); } @-webkit-keyframes play { 0% { -webkit-transform : rotateZ (0deg ); } 100% { -webkit-transform : rotateZ (-360deg ); } } @-moz-keyframes play { 0% { -moz-transform : rotateZ (0deg ); } 100% { -moz-transform : rotateZ (-360deg ); } } @keyframes play { 0% { transform : rotateZ (0deg ); } 100% { transform : rotateZ (-360deg ); } }
(4)背景动画(未实现)