新博客 发表于 2026-01-24 | 更新于 2026-01-24
| 总字数: 526 | 阅读时长: 2分钟 | 浏览量: |
Hexo搭建的博客无了~~~ 然后现在重新搭建一下,记录一下改的东西 需要安装Nodejs 我目前使用的安装器是yarn,这个是可以换的
安装Hexo+Butterfly Hexo文档: https://hexo.io/ Butterfly文档: https://butterfly.js.org/
安装
初始化 1 2 hexo init git clone -b master https://github.com/jerryc127/hexo-theme-butterfly.git themes/butterfly
使用主题 修改_config.yml文件
pug文件错误 1 yarn add hexo-renderer-pug hexo-renderer-stylus
更多配置看上面的文档链接
一些基础配置 不要显示顶部图,直接配置disable_top_img: true
首先就是帖子链接的问题 安装: https://github.com/ohroy/hexo-abbrlink
修改_config.yml文件,例子如下:
1 2 3 4 5 6 7 8 9 10 11 url: https://blog.greglee.cn permalink: posts/:abbrlink/ abbr.link: alg: crc32 rep: hex permalink_defaults: pretty_urls: trailing_index: false trailing_html: false
字数统计
F12提示 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 61 (function ( ) { 'use strict' ; var MESSAGE_TEXT = '已打开开发者模式,请谨记GPL协议!' ; var SIZE_THRESHOLD = 160 ; var CHECK_INTERVAL = 500 ; var lastState = false ; function showTip ( ) { if (typeof Snackbar !== 'undefined' && Snackbar .show ) { Snackbar .show ({ text : MESSAGE_TEXT , pos : 'top-right' , showAction : false , duration : 4000 }); } else { alert (MESSAGE_TEXT ); } } function keyListener (e ) { var isF12 = (e.key && e.key === 'F12' ) || e.keyCode === 123 ; var isCtrlShiftI = (e.ctrlKey || e.metaKey ) && e.shiftKey && (e.key === 'I' || e.key === 'i' ); var isCtrlShiftJ = (e.ctrlKey || e.metaKey ) && e.shiftKey && (e.key === 'J' || e.key === 'j' ); if (isF12 || isCtrlShiftI || isCtrlShiftJ) { setTimeout (showTip, 50 ); } } function isDevToolsOpenBySize ( ) { var widthDiff = Math .abs (window .outerWidth - window .innerWidth ); var heightDiff = Math .abs (window .outerHeight - window .innerHeight ); return widthDiff > SIZE_THRESHOLD || heightDiff > SIZE_THRESHOLD ; } function periodicCheck ( ) { var open = isDevToolsOpenBySize (); if (open && !lastState) { showTip (); } lastState = open; } function init ( ) { if (window .top !== window .self ) return ; window .addEventListener ('keydown' , keyListener, false ); window .addEventListener ('resize' , function ( ) { setTimeout (periodicCheck, 50 ); }, false ); setInterval (periodicCheck, CHECK_INTERVAL ); } init (); })();