这个文章主要用来记录博客的日常改动,比如功能更新、样式调整、内容修正等。
2026年4月23日及以前操作 主题更换
redefine
觉得butterfly更好,遂更换。 2. butterfly
功能全,但过于冗余,因个人能力有限,看遍文章也未能解决Google广告植入问题,遂更换
keep
目前在用,一切良好
新增豆瓣电影页面 本次更新新增了一个豆瓣电影页面。
通过引入 hexo-douban插件 ,实现Hexo博客中展示个人的豆瓣观影记录及评论。
相关项目与使用说明可参考其开源仓库:https://github.com/mythsman/hexo-douban
打包指令 为了方便,我将hexo clean、hexo generate、hexo server整合为一个指令:npm run s,把hexo clean``hexo generate``hexo deploy整合为一个指令:npm run d
把如下代码添加到项目根目录的package.json里的scripts字段。
1 2 "s" : "hexo clean && hexo generate && hexo server" , "d" : "hexo clean && hexo generate && hexo deploy"
修改b站嵌入代码 修改 B 站默认嵌入代码,使其同时适配移动端与PC端,并关闭自动播放功能。
旧版
1 <iframe src ="//player.bilibili.com/player.html?isOutside=true&aid=898762590&bvid=BV1MN4y177PB&cid=783037295&p=1" scrolling ="no" border ="0" frameborder ="no" framespacing ="0" allowfullscreen ="true" > </iframe >
新版
1 2 3 4 5 6 7 <div style ="width:100%;aspect-ratio:16/9;overflow:hidden;position:relative;background:#000;" > <iframe src ="//player.bilibili.com/player.html?isOutside=true&aid=898762590&bvid=BV1MN4y177PB&cid=783037295&p=1&autoplay=0" style ="position:absolute;top:0;left:0;width:100%;height:100%;border:0;" allowfullscreen > </iframe > </div >
预览:
旧版
新版
引入“霞鹜文楷”字体 统一字体,设置排版,在blog\hexo-theme-keep-starter\source\css\custom.css中添加如下代码:
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 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 @import url("https://cdn.jsdelivr.net/npm/lxgw-wenkai-webfont@1.6.0/style.css" );:root { --base-font-family : "LXGW WenKai" , serif; --base-font-size : 18px ; } .keep-markdown-body { line-height : 1.8 ; letter-spacing : 0.02em ; } .keep-markdown-body h1 { font-size : 38px ; }.keep-markdown-body h2 { font-size : 34px ; }.keep-markdown-body h3 { font-size : 30px ; }.keep-markdown-body h4 { font-size : 26px ; }.keep-markdown-body h5 { font-size : 22px ; }.keep-markdown-body h6 { font-size : 20px ; }.keep-markdown-body h1 ,.keep-markdown-body h2 ,.keep-markdown-body h3 ,.keep-markdown-body h4 ,.keep-markdown-body h5 ,.keep-markdown-body h6 { margin-top : 1.4em ; margin-bottom : 0.6em ; } .keep-markdown-body p { margin : 1em 0 ; } .first-screen-description ,.first-screen-hitokoto ,#hitokoto { font-family : var (--base-font-family); } :root { --box-border-radius : 20px ; } .keep-markdown-body strong ,.keep-markdown-body b { font-weight : 600 ; text-shadow : 0.3px 0 0 currentColor, -0.3px 0 0 currentColor, 0 0.3px 0 currentColor, 0 -0.3px 0 currentColor; font-family : var (--base-font-family); }
增加f12控制台整蛊代码 在blog\hexo-theme-keep-starter\node_modules\hexo-theme-keep\layout\_partial\footer.ejs中添加如下代码:
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 <script > window .addEventListener ('load' , function ( ) { let count = 0 ; const total = 30 ; const messages = [ "你看个蛋哦 👀" , "系统检测到异常操作 ⚠️" , "不要乱点,我在看着你 👁️" , "警告:不要偷看控制台 😏" , "Error: 页面正在崩溃中 💥" , "偷偷看源码?不行不行 🚫" , "你的浏览器被我盯上了 👻" , "警告:再看就要炸啦 ⚡" , "Error: 数据丢失(其实没有)" , "小心!有人在监视你的操作 👀" ]; let timer = setInterval (() => { let type = Math .random () < 0.5 ? 'warn' : 'error' ; let msg = messages[Math .floor (Math .random () * messages.length )]; console [type](msg); count++; if (count >= total) { clearInterval (timer); } }, 100 ); }); </script >
增加建站时间显示 在blog\hexo-theme-keep-starter\source\js\custom-1.js中添加以下代码:
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 function runningTime ( ){ const pv = document .querySelector ("#busuanzi_value_site_pv" ); if (!pv) return ; if (document .querySelector (".running-time" )) return ; const span = document .createElement ("span" ); span.className = "running-time" ; pv.parentNode .appendChild (span); const start = new Date ("2024-01-01 00:00:00" ).getTime (); function update ( ){ const diff = Date .now () - start; const d = Math .floor (diff/86400000 ); const h = Math .floor (diff%86400000 /3600000 ); const m = Math .floor (diff%3600000 /60000 ); const s = Math .floor (diff%60000 /1000 ); span.innerHTML = ` | 本站已运行 ${d} 天 ${h} 小时 ${m} 分 ${s} 秒` ; } update (); setInterval (update,1000 ); } document .addEventListener ("DOMContentLoaded" , runningTime);document .addEventListener ("pjax:complete" , runningTime);