本文搭建地址https://liangshao666.github.io/
安装 hexo
npm install hexo-cli -g hexo init myblog npm install hexo-deployer-git --save npm install hexo-renderer-pug hexo-renderer-stylus --save
或者参考HEXO搭建此篇文章中
方框圈住的windows和Linux通用命令
安装 Butterfly
git clone -b master https://github.com/jerryc127/hexo-theme-butterfly.git themes/butterfly
修改 Hexo 根目录下的 _config.yml,把主题改为butterfly
- theme: butterfly
安装插件
如果你没有 pug 以及 stylus 的渲染器,请下载安装:
- npm install hexo–renderer–pug hexo–renderer–stylus —save
配置
然后在 hexo 的根目录创建一个文件 _config.butterfly.yml,并把主题(theme文件夹下)目录里面的 _config.yml 文件内容复製到 _config.butterfly.yml 里面去。( 注意: 复製的是主题的 _config.yml ,而不是 hexo 根目录下的 _config.yml)
参考教程:
hexo安装Butterfly主题基于官网文档
https://butterfly.js.org/posts/21cfbf15/#%E5%AE%89%E8%A3%9D
配置文章链接转数字或字母
参考: https://github.com/rozbo/hexo-abbrlink
npm install hexo-abbrlink --save
permalink: posts/:abbrlink/
# or
permalink: posts/:abbrlink.html
There are two settings:
alg -- Algorithm (currently support crc16 and crc32, which crc16 is default)
rep -- Represent (the generated link could be presented in hex or dec value)
# abbrlink config
abbrlink:
alg: crc32 #support crc16(default) and crc32
rep: hex #support dec(default) and hex
drafts: false #(true)Process draft,(false)Do not process draft. false(default)
# Generate categories from directory-tree
# depth: the max_depth of directory-tree you want to generate, should > 0
auto_category:
enable: true #true(default)
depth: #3(default)
over_write: false
auto_title: false #enable auto title, it can auto fill the title by path
auto_date: false #enable auto date, it can auto fill the date by time today
force: false #enable force mode,in this mode, the plugin will ignore the cache, and calc the abbrlink for eve
_config.yml
打开配置文件找到permalink替换为permalink: posts/:abbrlink.html
及在配置文件末添加
# abbrlink config
abbrlink:permalink: posts/:abbrlink.html
alg: crc32 #support crc16(default) and crc32
rep: hex #support dec(default) and hex
本地搜索依赖
参考:https://github.com/wzpan/hexo-generator-search
npm install hexo-generator-search --save
你可以在你的 root 中配置这个插件_config.yml。
search:
path: search.xml
field: post
content: true
template: ./search.xml
打开_config.yml配置文件在文末加上search:
_config.yml
path: search.xml
field: all
content: true
并在_config.butterfly.yml文件夹中找到并修改为如下配置
# Local search
local_search:.
enable: true
preload: false
CDN:
修改conf
# Site title: limo' Blog subtitle: ' 梦想是什么,梦想是现实的延续;现实是什么,现实是梦想的终结。' description: '转瞬即逝的相逢与离别,每一个瞬间,我都想要珍惜' keywords: 'limo,limo note,博客,limo miao note,limo qq2328031994' author: limo language: zh-CN timezone: ''
hexo安装音乐、追番页、live2d看板娘安装
deploy: - type: git repository: # github: git@github.com:limo/liangshao666.github.io.git #用户名@服务器Ip:git仓库位置 github: https://liangshao666:xxx@github.com/liangshao666/liangshao666.github.io.git branch: master - type: baidu_url_submitter # 这是新加的百度主动推送
– type: baidu_url_submitter # 这是新加的百度主动推送
将以上红色字体复制到_config.yml文件中deploy里
然后将以下内容复制并粘贴进_config.yml的文件末尾
# Live2D ## https://github.com/EYHN/hexo-helper-live2d live2d: enable: true #开关插件版看板娘 scriptFrom: local # 默认 # scriptFrom: https://cdn.cbd.int/live2d-widget@3.x/lib/L2Dwidget.min.js # 你的自定义 url tagMode: false # 标签模式, 是否仅替换 live2d tag标签而非插入到所有页面中 debug: false # 调试, 是否在控制台输出日志 model: use: live2d-widget-model-koharu # npm-module package name # use: https://unpkg.com/live2d-widget-model-koharu@1.0.5/assets/koharu.model.json # 你的自定义 url display: position: left #控制看板娘位置 width: 150 #控制看板娘大小 height: 300 #控制看板娘大小 mobile: show: false # 手机中是否展示 # https://github.com/hexojs/hexo-generator-sitemap sitemap: path: sitemap.xml rel: false tags: true categories: true # https://github.com/coneycode/hexo-generator-baidu-sitemap baidusitemap: path: baidusitemap.xml # https://github.com/hexojs/hexo-generator-feed #Feed Atom feed: type: atom path: atom.xml limit: 20 rss: /atom.xml # Extensions plugins: - hexo-generator-feed - hexo-generator-baidu-sitemap - hexo-generator-sitemap # 追番插件 # https://github.com/HCLonely/hexo-bilibili-bangumi bangumi: # 追番设置 enable: true path: vmid: 372204786 title: '追番列表' quote: '生命不息,追番不止!' show: 1 lazyload: false loading: metaColor: color: webp: progress: extra_options: key: value cinema: # 追剧设置 enable: false path: vmid: 372204786 title: '追剧列表' quote: '生命不息,追剧不止!' show: 1 lazyload: true loading: metaColor: color: webp: progress: extra_options: key: value # 百度主动推送 # https://github.com/huiwang/hexo-baidu-url-submit baidu_url_submit: count: 1 # 提交最新的多少个链接 host: blog.anzhiy.cn # 在百度站长平台中添加的域名 token: Rgem9kAECSLflQq6 # 秘钥 path: baidu_urls.txt # 文本文档的地址, 新链接会保存在此文本文档里 # APlayer # https://github.com/MoePlayer/hexo-tag-aplayer/blob/master/docs/README-zh_cn.md aplayer: meting: true asset_inject: false<strong>_config.yml</strong>
然后安装live2d
live2d
安装live2d npm install --save hexo-helper-live2d |
安装模型 npm install --save live2d-widget-model-koharu |
sitemap
npm install hexo-generator-sitemap --save npm install hexo-generator-baidu-sitemap --save-dev |
Rss
npm install hexo-generator-feed --save
|
追番插件(# 追番插件 https://github.com/HCLonely/hexo-bilibili-bangumi)
npm install hexo-bilibili-bangumi --save
|
因为这个插件和这个主题有冲突所以到_config.butterfly.yml文件下将图片懒加载lazyzoad开启
配置好运行前 使用hexo bangumi -u
命令更新追番数据
修改主题配置(_config.butterfly.yml)
这个在最上面将注释去掉及添加追番
menu:
Home: / || fas fa-home
追番: /bangumis/index.html || fas fa-home
百度主动推送
npm install hexo-baidu-url-submit --save
|
aplayer 音乐播放器(_config.butterfly.yml)
npm install hexo-tag-aplayer --save
|
aplayerInject: enable: true per_page: true |
改成true防止重复加载
# aplayer音乐 - <div class="aplayer no-destroy" data-id="1708664797" data-server="tencent" data-type="playlist" data-order="list" data-fixed="true" data-preload="auto" data-autoplay="false" data-mutex="true" ></div> |
配置自定义css
新建文件[Blogroot]/source/css/custom.css
,在custom.css中填入以下内容
如果不需要一图流,请删除167行
这一部分代码
/* 页脚透明 */ #footer { background: transparent ; } /* 头图透明 */ #page-header { background: transparent ; } |
在_config.butterfly.yml
中搜索Inject添加以下代码,将自定义csscustom.css
引入
inject: head: - <link rel="stylesheet" href="/css/custom.css" media="defer" onload="this.media='all'"> |
配置 pwa
参考方向 | 教程原贴 |
---|---|
店长原教程 | Butterfly主题的PWA实现方案 |
安装必要插件
npm install --global gulp-cli # 全局安装gulp命令集 npm install workbox-build gulp --save # 安装workbox和gulp插件 # 压缩html插件 npm install gulp-htmlclean --save-dev npm install --save gulp-htmlmin # 压缩css插件 npm install gulp-clean-css --save-dev # 压缩js插件 # 使用babel压缩js,与terser二选一 npm install --save-dev gulp-uglify npm install --save-dev gulp-babel @babel/core @babel/preset-env # 使用terser压缩js,与babel二选一 npm install gulp-terser --save-dev npm install --save-dev gulp-babel @babel/core @babel/preset-env # 压缩图片插件 npm install --save-dev gulp-imagemin # 压缩字体插件(font-min仅支持压缩ttf格式的字体包) npm install gulp-fontmin --save-dev 上方二选一推荐使用红色字体命令(红色字体命令都要执行)
在 package.json 中添加
"type": "module",
|
创建gulpfile.js
在 Hexo 的根目录,创建一个gulpfile.js
文件,打开[Blogroot]/gulpfile.js
,
/* * @Description: gulp * @Author: 安知鱼 * @Email: 2268025923@qq.com * @Date: 2022-02-22 11:22:57 * @LastEditTime: 2022-08-18 12:24:11 * @LastEditors: 安知鱼 */ import gulp from 'gulp'; import cleanCSS from 'gulp-clean-css'; import htmlmin from 'gulp-htmlmin'; import htmlclean from 'gulp-htmlclean'; import workbox from 'workbox-build'; import fontmin from 'gulp-fontmin'; // 若使用babel压缩js,则取消下方注释,并注释terser的代码 // var uglify = require('gulp-uglify'); // var babel = require('gulp-babel'); // 若使用terser压缩js import terser from 'gulp-terser'; //pwa gulp.task('generate-service-worker', () => { return workbox.injectManifest({ swSrc: './sw-template.js', swDest: './public/sw.js', globDirectory: './public', globPatterns: [ // 缓存所有以下类型的文件,极端不推荐 // "**/*.{html,css,js,json,woff2,xml}" // 推荐只缓存404,主页和主要样式和脚本。 '404.html', 'index.html', 'js/main.js', 'css/index.css', ], modifyURLPrefix: { '': './', }, }); }); //minify js babel // 若使用babel压缩js,则取消下方注释,并注释terser的代码 // gulp.task('compress', () => // gulp.src(['./public/**/*.js', '!./public/**/*.min.js']) // .pipe(babel({ // presets: ['@babel/preset-env'] // })) // .pipe(uglify().on('error', function(e){ // console.log(e); // })) // .pipe(gulp.dest('./public')) // ); // minify js - gulp-tester // 若使用terser压缩js gulp.task('compress', () => gulp .src([ './public/**/*.js', '!./public/**/*.min.js', '!./public/js/custom/galmenu.js', '!./public/js/custom/gitcalendar.js', ]) .pipe(terser()) .pipe(gulp.dest('./public')) ); //css gulp.task('minify-css', () => { return gulp .src('./public/**/*.css') .pipe( cleanCSS({ compatibility: 'ie11', }) ) .pipe(gulp.dest('./public')); }); // 压缩 public 目录内 html gulp.task('minify-html', () => { return gulp .src('./public/**/*.html') .pipe(htmlclean()) .pipe( htmlmin({ removeComments: true, //清除 HTML 註释 collapseWhitespace: true, //压缩 HTML collapseBooleanAttributes: true, //省略布尔属性的值 <input checked="true"/> ==> <input /> removeEmptyAttributes: true, //删除所有空格作属性值 <input id="" /> ==> <input /> removeScriptTypeAttributes: true, //删除 <script> 的 type="text/javascript" removeStyleLinkTypeAttributes: true, //删除 <style> 和 <link> 的 type="text/css" minifyJS: true, //压缩页面 JS minifyCSS: true, //压缩页面 CSS minifyURLs: true, }) ) .pipe(gulp.dest('./public')); }); //压缩字体 function minifyFont(text, cb) { gulp .src('./public/fonts/*.ttf') //原字体所在目录 .pipe( fontmin({ text: text, }) ) .pipe(gulp.dest('./public/fontsdest/')) //压缩后的输出目录 .on('end', cb); } gulp.task('mini-font', cb => { var buffers = []; gulp .src(['./public/**/*.html']) //HTML文件所在目录请根据自身情况修改 .on('data', function (file) { buffers.push(file.contents); }) .on('end', function () { var text = Buffer.concat(buffers).toString('utf-8'); minifyFont(text, cb); }); }); // 执行 gulp 命令时执行的任务 gulp.task( 'default', gulp.series( 'generate-service-worker', gulp.parallel('compress', 'minify-html', 'minify-css', 'mini-font') ) );
创建在 Hexo 的根目录,创建一个sw-template.js
文件,打开[Blogroot]/sw-template.js
,输入以下内容:
/* * @Description: sw * @Author: 安知鱼 * @Email: 2268025923@qq.com * @Date: 2022-02-22 11:23:58 * @LastEditTime: 2022-03-08 12:24:30 * @LastEditors: 安知鱼 */ const workboxVersion = '5.1.3'; importScripts(`https://storage.googleapis.com/workbox-cdn/releases/${workboxVersion}/workbox-sw.js`); workbox.core.setCacheNameDetails({ prefix: 'LIMO 博客', }); workbox.core.skipWaiting(); workbox.core.clientsClaim(); // 注册成功后要立即缓存的资源列表 // 具体缓存列表在gulpfile.js中配置,见下文 workbox.precaching.precacheAndRoute(self.__WB_MANIFEST, { directoryIndex: null, }); // 清空过期缓存 workbox.precaching.cleanupOutdatedCaches(); // 图片资源(可选,不需要就注释掉) // workbox.routing.registerRoute( // /\.(?:png|jpg|jpeg|gif|bmp|webp|svg|ico)$/, // new workbox.strategies.CacheFirst({ // cacheName: 'images', // plugins: [ // new workbox.expiration.ExpirationPlugin({ // maxEntries: 1000, // maxAgeSeconds: 60 * 60 * 24 * 30, // }), // new workbox.cacheableResponse.CacheableResponsePlugin({ // statuses: [0, 200], // }), // ], // }) // ) // 字体文件(可选,不需要就注释掉) workbox.routing.registerRoute( /\.(?:eot|ttf|woff|woff2)$/, new workbox.strategies.CacheFirst({ cacheName: 'fonts', plugins: [ new workbox.expiration.ExpirationPlugin({ maxEntries: 1000, maxAgeSeconds: 60 * 60 * 24 * 30, }), new workbox.cacheableResponse.CacheableResponsePlugin({ statuses: [0, 200], }), ], }) ); // 谷歌字体(可选,不需要就注释掉) workbox.routing.registerRoute( /^https:\/\/fonts\.googleapis\.com/, new workbox.strategies.StaleWhileRevalidate({ cacheName: 'google-fonts-stylesheets', }) ); workbox.routing.registerRoute( /^https:\/\/fonts\.gstatic\.com/, new workbox.strategies.CacheFirst({ cacheName: 'google-fonts-webfonts', plugins: [ new workbox.expiration.ExpirationPlugin({ maxEntries: 1000, maxAgeSeconds: 60 * 60 * 24 * 30, }), new workbox.cacheableResponse.CacheableResponsePlugin({ statuses: [0, 200], }), ], }) ); // jsdelivr的CDN资源(可选,不需要就注释掉) // workbox.routing.registerRoute( // /^https:\/\/cdn\.jsdelivr\.net/, // new workbox.strategies.CacheFirst({ // cacheName: 'static-libs', // plugins: [ // new workbox.expiration.ExpirationPlugin({ // maxEntries: 1000, // maxAgeSeconds: 60 * 60 * 24 * 30, // }), // new workbox.cacheableResponse.CacheableResponsePlugin({ // statuses: [0, 200], // }), // ], // }) // ) workbox.googleAnalytics.initialize();
在[Blogroot]\themes\butterfly\layout\includes\third-party\
目录下新建pwanotice.pug
文件,
打开[Blogroot]\themes\butterfly\layout\includes\third-party\pwanotice.pug
,输入:
#app-refresh.app-refresh(style='position: fixed;top: -2.2rem;left: 0;right: 0;z-index: 99999;padding: 0 1rem;font-size: 15px;height: 2.2rem;transition: all 0.3s ease;') .app-refresh-wrap(style=' display: flex;color: #fff;height: 100%;align-items: center;justify-content: center;') label ✨ 有新文章啦! ? a(href='javascript:void(0)' onclick='location.reload()') span(style='color: #fff;text-decoration: underline;cursor: pointer;') ?点击食用? script. if ('serviceWorker' in navigator) { if (navigator.serviceWorker.controller) { navigator.serviceWorker.addEventListener('controllerchange', function() { showNotification() }) } window.addEventListener('load', function() { navigator.serviceWorker.register('/sw.js') }) } function showNotification() { if (GLOBAL_CONFIG.Snackbar) { var snackbarBg = document.documentElement.getAttribute('data-theme') === 'light' ? GLOBAL_CONFIG.Snackbar.bgLight : GLOBAL_CONFIG.Snackbar.bgDark var snackbarPos = GLOBAL_CONFIG.Snackbar.position Snackbar.show({ text: '✨ 有新文章啦! ?', backgroundColor: snackbarBg, duration: 500000, pos: snackbarPos, actionText: '?点击食用?', actionTextColor: '#fff', onActionClick: function(e) { location.reload() }, }) } else { var showBg = document.documentElement.getAttribute('data-theme') === 'light' ? '#425aef' : '#1f1f1f' var cssText = `top: 0; background: ${showBg};` document.getElementById('app-refresh').style.cssText = cssText } } |
修改[Blogroot]\themes\butterfly\layout\includes\additional-js.pug
,在文件底部添加以下内容,注意缩进。butterfly_v3.6.0
取消了缓存配置,转为完全默认,需要将{cache:theme.fragment_cache}
改为{cache: true}
:
if theme.pjax.enable !=partial('includes/third-party/pjax', {}, {cache:theme.fragment_cache}) !=partial('includes/third-party/baidu_push', {}, {cache:theme.fragment_cache}) + if theme.pwa.enable + !=partial('includes/third-party/pwanotice', {}, {cache: true}) |
下载: https://cloud.anzhiy.cn/s/Xbw8uL
将你的图标包移入相应的目录,例如我是/img/siteicon/
,所以放到[Blogroot]/source/img/siteicon/
目录下。
新建文件名为manifest.json
并将其放到[Blogroot]/source
目录下,此时还不能直接用,需要添加一些内容,以下是我的manifest.json
配置内容,权且作为参考,其中的theme_color
建议用取色器取设计的图标的主色调,同时务必配置 start_url 和 name 的配置项,这关系到你之后能否看到浏览器的应用安装按钮。:
{ "name": "limo`Blog", "short_name": "limo", "theme_color": "#425aef", "background_color": "#425aef", "display": "standalone", "scope": "/", "start_url": "/", "icons": [{ "src": "/img/siteicon/16.png", "sizes": "16x16", "type": "image/png" }, { "src": "/img/siteicon/32.png", "sizes": "32x32", "type": "image/png" }, { "src": "/img/siteicon/48.png", "sizes": "48x48", "type": "image/png" }, { "src": "/img/siteicon/64.png", "sizes": "64x64", "type": "image/png" }, { "src": "/img/siteicon/128.png", "sizes": "128x128", "type": "image/png" }, { "src": "/img/siteicon/144.png", "sizes": "144x144", "type": "image/png" }, { "src": "/img/siteicon/512.png", "sizes": "512x512", "type": "image/png" } ], "splash_pages": null } |
打开主题配置文件[Blogroot]/_config.butterfly.yml
,找到PWA
配置项。添加图标路径。这里的 theme_color 建议改成你图标的主色调,包括manifest.json
中的theme_color
也是如此。
pwa: enable: true manifest: /manifest.json theme_color: '#425aef' apple_touch_icon: /img/siteicon/128.png favicon_32_32: /img/siteicon/32.png favicon_16_16: /img/siteicon/16.png mask_icon: /img/siteicon/128.png |
添加外挂标签
新建[Blogroot]/source/js/ali_font.js
, 输入以下内容
点击此处去复制
然后再执行以下命令
# https://www.npmjs.com/package/hexo-butterfly-tag-plugins-plus npm install hexo-butterfly-tag-plugins-plus --save npm uninstall hexo-renderer-marked --save npm install hexo-renderer-kramed --save |
添加配置项(_config.butterfly.yml)
# tag-plugins-plus # see https://akilar.top/posts/615e2dec/ tag_plugins: enable: true # 开关 priority: 5 #过滤器优先权 issues: false #issues标签开关 link: placeholder: /img/siteicon/64.png #link_card标签默认的图标图片 CDN: anima: https://cdn.cbd.int/hexo-butterfly-tag-plugins-plus@latest/lib/assets/font-awesome-animation.min.css #动画标签anima的依赖 jquery: https://cdn.cbd.int/jquery@latest/dist/jquery.min.js #issues标签依赖 issues: https://cdn.cbd.int/hexo-butterfly-tag-plugins-plus@latest/lib/assets/issues.js #issues标签依赖 iconfont: /js/ali_font.js #参看https://akilar.top/posts/d2ebecef/ carousel: https://cdn.cbd.int/hexo-butterfly-tag-plugins-plus@latest/lib/assets/carousel-touch.js tag_plugins_css: https://cdn.cbd.int/hexo-butterfly-tag-plugins-plus@latest/lib/tag_plugins.css
然后外挂标签就配置完成了
外挂标签样式可参考安知鱼https://anzhiy.cn/posts/7d58.html
添加 wowjs特效
参考:wowjs 特效
npm install hexo-butterfly-wowjs --save
|
添加配置项
# wowjs # see https://www.npmjs.com/package/hexo-butterfly-wowjs wowjs: enable: true #控制动画开关。true是打开,false是关闭 priority: 10 #过滤器优先级 mobile: false #移动端是否启用,默认移动端禁用 animateitem: - class: recent-post-item #必填项,需要添加动画的元素的class style: animate__zoomIn #必填项,需要添加的动画 duration: 1.5s #选填项,动画持续时间,单位可以是ms也可以是s。例如3s,700ms。 delay: 200ms #选填项,动画开始的延迟时间,单位可以是ms也可以是s。例如3s,700ms。 offset: 30 #选填项,开始动画的距离(相对浏览器底部) iteration: 1 #选填项,动画重复的次数 - class: card-widget style: animate__zoomIn delay: 200ms # - class: flink-list-card # style: wowpanels - class: flink-list-card style: animate__flipInY duration: 3s - class: flink-list-card style: animate__animated duration: 3s - class: article-sort-item style: animate__slideInRight duration: 1.5s - class: site-card style: animate__flipInY duration: 3s - class: site-card style: animate__animated duration: 3s animate_css: https://cdn.cbd.int/hexo-butterfly-wowjs/lib/animate.min.css wow_js: https://cdn.cbd.int/hexo-butterfly-wowjs/lib/wow.min.js wow_init_js: https://cdn.cbd.int/hexo-butterfly-wowjs/lib/wow_init.js |
留言板:薇尔莉特信封
npm install hexo-butterfly-envelope --save
|
添加配置项
# envelope_comment # see https://akilar.top/posts/e2d3c450/ # envelope_comment # see https://akilar.top/posts/e2d3c450/ envelope_comment: enable: true #控制开关 custom_pic: cover: https://cdn.cbd.int//hexo-butterfly-envelope/lib/violet.jpg #信笺头部图片 line: https://cdn.cbd.int/hexo-butterfly-envelope/lib/line.png #信笺底部图片 beforeimg: https://cdn.cbd.int/hexo-butterfly-envelope/lib/before.png # 信封前半部分 afterimg: https://cdn.cbd.int/hexo-butterfly-envelope/lib/after.png # 信封后半部分 message: #信笺正文,多行文本,写法如下 - 有什么想问的? - 有什么想说的? - 有什么想吐槽的? - 哪怕是有什么想吃的,都可以告诉我哦~ bottom: 自动书记人偶竭诚为您服务! #仅支持单行文本 height: #1050px,信封划出的高度 path: #【可选】comments 的路径名称。默认为 comments,生成的页面为 comments/index.html front_matter: #【可选】comments页面的 front_matter 配置 title: 留言板 comments: true |
留言板: /comments/ || fas fa-envelope
|
电子钟
参考:https://anzhiy.cn/posts/fc18.html
npm install hexo-butterfly-clock-anzhiyu --save
|
添加配置项
# electric_clock # see https://anzhiy.cn/posts/fc18.html electric_clock: enable: true # 开关 priority: 5 #过滤器优先权 enable_page: all # 应用页面 exclude: # - /posts/ # - /about/ layout: # 挂载容器类型 type: class name: sticky_layout index: 0 loading: https://cdn.cbd.int/hexo-butterfly-clock-anzhiyu@1.1.6/lib/loading.gif #加载动画自定义 clock_css: https://cdn.cbd.int/hexo-butterfly-clock-anzhiyu@1.1.6/lib/clock.min.css clock_js: https://cdn.cbd.int/hexo-butterfly-clock-anzhiyu@1.1.6/lib/clock.min.js ip_api: https://widget.qweather.net/simple/static/js/he-simple-common.js?v=2.0 qweather_key: # 和风天气key gaud_map_key: # 高得地图web服务key default_rectangle: true # 开启后将一直显示rectangle位置的天气,否则将获取访问者的地理位置与天气 rectangle: 112.6534116,27.96920845 # 获取访问者位置失败时会显示该位置的天气,同时该位置为开启default_rectangle后的位置 |
页脚 github 徽标和计时器
参考: https://www.npmjs.com/package/hexo-butterfly-footer-beautify
npm install hexo-butterfly-footer-beautify --save
|
添加配置项
# footer_beautify # 页脚计时器:[Native JS Timer](https://akilar.top/posts/b941af/) # 页脚徽标:[Add Github Badge](https://akilar.top/posts/e87ad7f8/) footer_beautify: enable: timer: true # 计时器开关 bdage: true # 徽标开关 priority: 5 #过滤器优先权 enable_page: all # 应用页面 exclude: # - /posts/ # - /about/ layout: # 挂载容器类型 type: id name: footer-wrap index: 0 # 计时器部分配置项 runtime_js: https://npm.elemecdn.com/anzhiyu-blog@2.0.4/js/runtime/runtime.min.js runtime_css: https://npm.elemecdn.com/anzhiyu-blog@2.0.4/css/runtime/runtime.min.css # 徽标部分配置项 swiperpara: 0 #若非0,则开启轮播功能,每行徽标个数 bdageitem: - link: https://hexo.io/ #徽标指向网站链接 shields: https://img.shields.io/badge/Frame-Hexo-blue?style=flat&logo=hexo #徽标API message: 博客框架为Hexo_v5.4.0 #徽标提示语 - link: https://butterfly.js.org/ shields: https://img.shields.io/badge/Theme-Butterfly-6513df?style=flat&logo=bitdefender message: 主题版本Butterfly_v4.2.2 - link: https://www.jsdelivr.com/ shields: https://img.shields.io/badge/CDN-jsDelivr-orange?style=flat&logo=jsDelivr message: 本站使用JsDelivr为静态资源提供CDN加速 - link: https://beian.miit.gov.cn/#/Integrated/index shields: https://img.shields.io/badge/湘ICP备-2022004213号-e1d492?style=flat&logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAB4AAAAdCAYAAAC9pNwMAAABS2lUWHRYTUw6Y29tLmFkb2JlLnhtcAAAA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rn5ZNj5Lo/Qc/GcPMmhdoqlEgIGzCK4PiCmJKK68p4KfF3qYGuF0qCRUkJTzleUbvQyWRTuE5xYthxQbBs7EISAbkzUFG3VfXXbK2YFi3X/eryfKKnqVBItNjJxDzH8erddC4SqWwcN5WyTtlyO1RP/Lh3eHD76MB40swmiDVJyDLYRhpc5+ub6tse/wWKbvSQEAw1awAAAABJRU5ErkJggg== message: 本站已在湘进行备案 - link: https://github.com/ shields: https://img.shields.io/badge/Source-Github-d021d6?style=flat&logo=GitHub message: 本站项目由Github托管 - link: http://creativecommons.org/licenses/by-nc-sa/4.0/ shields: https://img.shields.io/badge/Copyright-BY--NC--SA%204.0-d42328?style=flat&logo=Claris message: 本站采用知识共享署名-非商业性使用-相同方式共享4.0国际许可协议进行许可 # swiper_css: https://cdn.cbd.int/hexo-butterfly-swiper/lib/swiper.min.css # swiper_js: https://cdn.cbd.int/hexo-butterfly-swiper/lib/swiper.min.js # swiperbdage_init_js: https://cdn.cbd.int/hexo-butterfly-footer-beautify/lib/swiperbdage_init.min.js |
runtime.js
var now=new Date;function createtime(){var grt=new Date("04/01/2021 00:00:00");now.setTime(now.getTime()+250);var days=(now-grt)/1e3/60/60/24,dnum=Math.floor(days),hours=(now-grt)/1e3/60/60-24*dnum,hnum=Math.floor(hours);1==String(hnum).length&&(hnum="0"+hnum);var minutes=(now-grt)/1e3/60-1440*dnum-60*hnum,mnum=Math.floor(minutes);1==String(mnum).length&&(mnum="0"+mnum);var seconds=(now-grt)/1e3-86400*dnum-3600*hnum-60*mnum,snum=Math.round(seconds);1==String(snum).length&&(snum="0"+snum);let currentTimeHtml="";currentTimeHtml=hnum<18&&hnum>=9?`<img class='boardsign' src='https://npm.elemecdn.com/anzhiyu-blog@2.0.4/img/badge/安知鱼-上班摸鱼中.svg' title='距离月入25k也就还差一个大佬带我~'><span class='textTip'> <br> 本站居然运行了 ${dnum} 天</span><span id='runtime'> ${hnum} 小时 ${mnum} 分 ${snum} 秒 </span> <i class='fas fa-heartbeat' style='color:red'></i>`:`<img class='boardsign' src='https://npm.elemecdn.com/anzhiyu-blog@2.0.4/img/badge/安知鱼-下班啦.svg' title='下班了就该开开心心的玩耍,嘿嘿~'><span class='textTip'> <br> 本站居然运行了 ${dnum} 天</span><span id='runtime'> ${hnum} 小时 ${mnum} 分 ${snum} 秒 </span> <i class='fas fa-heartbeat' style='color:red'></i>`,document.getElementById("workboard")&&(document.getElementById("workboard").innerHTML=currentTimeHtml)}setInterval(()=>{createtime()},250);
|
Gitcalendar github贡献图
参考:https://akilar.top/posts/1f9c68c9/
npm install hexo-filter-gitcalendar --save
|
添加配置项
# hexo-filter-gitcalendar # see https://akilar.top/posts/1f9c68c9/ gitcalendar: enable: true # 开关 priority: 5 #过滤器优先权 enable_page: / # 应用页面 # butterfly挂载容器 layout: # 挂载容器类型 type: id name: recent-posts index: 0 user: anzhiyu-c #git用户名 apiurl: 'https://python-github-calendar-api-spk83h666-anzhiyu-c.vercel.app' minheight: pc: 280px #桌面端最小高度 mibile: 0px #移动端最小高度 # color: "['#e4dfd7', '#f9f4dc', '#f7e8aa', '#f7e8aa', '#f8df72', '#fcd217', '#fcc515', '#f28e16', '#fb8b05', '#d85916', '#f43e06']" #橘黄色调 color: "['#ebedf0', '#fdcdec', '#fc9bd9', '#fa6ac5', '#f838b2', '#f5089f', '#c4067e', '#92055e', '#540336', '#48022f', '#30021f']" #浅紫色调 # color: "['#ebedf0', '#f0fff4', '#dcffe4', '#bef5cb', '#85e89d', '#34d058', '#28a745', '#22863a', '#176f2c', '#165c26', '#144620']" #翠绿色调 # color: "['#ebedf0', '#f1f8ff', '#dbedff', '#c8e1ff', '#79b8ff', '#2188ff', '#0366d6', '#005cc5', '#044289', '#032f62', '#05264c']" #天青色调 container: .recent-post-item(style='width:100%;height:auto;padding:10px;') #父元素容器,需要使用pug语法 gitcalendar_css: https://cdn.cbd.int/hexo-filter-gitcalendar/lib/gitcalendar.css gitcalendar_js: https://cdn.cbd.int/hexo-filter-gitcalendar/lib/gitcalendar.js |
Swiper Bar
点击查看参考教程
参考方向 | 教程原贴 |
---|---|
店长原教程 | Swiper Bar |
- 安装插件,在博客根目录
[Blogroot]
下打开终端,运行以下指令:
npm install hexo-butterfly-swiper --save
- 添加配置信息,以下为写法示例
在站点配置文件_config.yml
或者主题配置文件_config.butterfly.yml
中添加# hexo-butterfly-swiper # see https://akilar.top/posts/8e1264d1/ swiper: enable: true # 开关 priority: 5 #过滤器优先权 enable_page: all # 应用页面 timemode: date #date/updated layout: # 挂载容器类型 type: id name: recent-posts index: 0 default_descr: 再怎么看我也不知道怎么描述它的啦! swiper_css: https://npm.elemecdn.com/hexo-butterfly-swiper/lib/swiper.min.css #swiper css依赖 swiper_js: https://npm.elemecdn.com/hexo-butterfly-swiper/lib/swiper.min.js #swiper js依赖 custom_css: https://npm.elemecdn.com/hexo-butterfly-swiper/lib/swiperstyle.css # 适配主题样式补丁 custom_js: https://npm.elemecdn.com/hexo-butterfly-swiper/lib/swiper_init.js # swiper初始化方法
使用方法
在文章的front_matter
中添加swiper_index
配置项即可。
--- title: 文章标题 date: 创建日期 updated: 更新日期 cover: 文章封面 description: 文章描述 swiper_index: 1 #置顶轮播图顺序,非负整数,数字越大越靠前 --- |
hexo-butterfly-categories-card
点击查看参考教程
参考方向 | 教程原贴 |
---|---|
店长原教程 | Categories Magnet |
安装插件,在博客根目录[Blogroot]
下打开终端,运行以下指令:
npm install hexo-butterfly-categories-card --save
|
- 添加配置信息,以下为写法示例
在站点配置文件_config.yml
或者主题配置文件_config.butterfly.yml
中添加 -
# hexo-butterfly-categories-card # see https://akilar.top/posts/a9131002/ categoryBar: enable: true # 开关 priority: 5 #过滤器优先权 enable_page: / # 应用页面 layout: # 挂载容器类型 type: id name: recent-posts index: 0 column: odd # odd:3列 | even:4列 row: 1 #显示行数,默认两行,超过行数切换为滚动显示 message: - descr: 诗词歌赋 cover: https://cdn.cbd.int/akilar-candyassets@1.0.36/image/cover1.webp - descr: 杂谈教程 cover: https://cdn.cbd.int/akilar-candyassets@1.0.36/image/cover2.webp - descr: 个人日记 cover: https://cdn.cbd.int/akilar-candyassets@1.0.36/image/cover3.webp - descr: cover: https://cdn.cbd.int/akilar-candyassets@1.0.36/image/cover4.webp - descr: cover: https://cdn.cbd.int/akilar-candyassets@1.0.36/image/cover5.webp - descr: cover: https://cdn.cbd.int/akilar-candyassets@1.0.36/image/cover6.webp custom_css: https://cdn.cbd.int/hexo-butterfly-categories-card@1.0.0/lib/categorybar.css
字数统计
npm install hexo-wordcount --save
|
站点动态 title
点击查看魔改站点动态 title 教程
添加自定义title.js
,然后主题配置文件inject
引入即可.
//动态标题 var OriginTitile = document.title; var titleTime; document.addEventListener('visibilitychange', function () { if (document.hidden) { //离开当前页面时标签显示内容 document.title = 'w(゚Д゚)w 不要走!再看看嘛!'; clearTimeout(titleTime); } else { //返回当前页面时标签显示内容 document.title = '♪(^∇^*)欢迎肥来!' + OriginTitile; //两秒后变回正常标题 titleTime = setTimeout(function () { document.title = OriginTitile; }, 2000); } }); |
头像
网上找一张你喜欢的图片,放到Hexo\source\image下
更改你的主题的配置文件
1
|
博客根目录\config.butterfly.ymll
|
打开,搜索avatar,更改;
1
|
avatar: /images/header.jpg
|
最新评论