Files
biss 72637c0b6d rss
-- [CST 2026-10-30 Friday 21:00:32]
2026-10-30 21:00:32 +08:00

1 line
12 KiB
JSON
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
{"title":"利用插件自定义页脚菜单","slug":"a6ab0925","url":"https://blog.biss.click/posts/a6ab0925/","date":"2025-08-12T09:19:16.000Z","updated":null,"summary":"这篇文章介绍了如何使用插件来自定义Hexo博客的页脚菜单。首先,通过npm安装了hexo-butterfly-footer-marcus插件,并根据需要安装了yamljs插件。接着,在博客的配置文件中添加了相关配置信息,包括页脚美化、图标链接、作者信息等。文章还提供了具体的参数释义和使用方法,指导读者如何填写配置项和修改源码来调整页脚样式和布局。最后,文章还提到了如何解决在黑暗模式下修改按钮层级的问题,并提供了相关的代码修改示例。","tags":["网站"],"categories":["建站手札"],"series":"webcustom","seriesOrder":null,"contentFormat":"text/markdown","content":"{% note warning %}\n注意:本文为早期 Hexo / Butterfly 魔改记录,本站现已迁移到 Astro,相关代码、路径或插件可能已经失效,仅作历史参考。\n{% endnote %}\n\n# 安装\n\n安装插件,在博客根目录[Blogroot]下打开终端,运行以下指令:\n\n```bash\nnpm install hexo-butterfly-footer-marcus --save\n```\n\n如果需要随机友链接的话,再运行以下指令:\n\n```bash\nnpm i yamljs --save\n```\n\n# 添加配置信息\n\n以下为写法示例 在站点配置文件_config.yml或者主题配置文件_config.butterfly.yml中添加\n\n```yml\n#hexo-butterfly-footer-marcus\n#see https://blog.marcus233.top/p/footer.html\nfooter_beautify:\n enable: true\n priority: 5 #过滤器优先权\n enable_page: all # 应用页面\n layout: # 挂载容器类型\n type: id\n name: footer\n index: 1\n footer_icons:\n enable: true\n left:\n - icon: fa-solid fa-compass\n link: https://www.marcus233.top/\n desrc: 个人主页\n class: out\n - icon: fa-brands fa-qq\n link: https://res.abeim.cn/api/qq/?qq=3105950984\n desrc: 联系QQ\n class: out\n - icon: fa-brands fa-weixin\n link: /wechat/\n desrc: 联系微信\n class: in\n - icon: fa-solid fa-envelope\n link: mailto:marcus@marcus233.top\n desrc: 发送邮件\n class: out\n right:\n - icon: fa-brands fa-github\n link: https://github.com/Marcusyyds\n desrc: Github主页\n class: out\n - icon: fa-brands fa-bilibili\n link: https://space.bilibili.com/1024450661\n desrc: 哔哩哔哩主页\n class: out\n - icon: fa-solid fa-star\n link: /stars/\n desrc: 藏宝阁\n class: in\n - icon: fa-solid fa-comment\n link: /message/\n desrc: 留言\n class: in\n footer_logo:\n enable: true\n url: https://img01.anheyu.com/useruploads/8/2022/12/15/639adf5b8806a.png\n footer_group:\n enable: true\n footer_group_link:\n - group_title: 直达\n footer_links: \n - text: 藏宝阁\n link: /stars/\n class: in\n - text: 优秀句子\n link: /sentence/\n class: in\n - text: 空间说说\n link: /zone/\n class: in\n - text: 友链订阅\n link: /fcircle/\n class: in\n - text: 切换背景\n link: /bg/\n class: in\n - group_title: 关于\n footer_links: \n - text: 关于我\n link: /about/\n class: in\n - text: RSS订阅\n link: /atom.xml\n class: in\n - text: 站点监控\n link: https://uptime.marcus233.top/\n class: out\n - text: 更新记录\n link: /timeline/\n class: in\n - text: 我的相册\n link: /picture/\n class: in\n - group_title: 分类\n footer_links: \n - text: 博客相关\n link: /categories/博客相关\n class: in\n - text: 生活点滴\n link: /categories/生活点滴\n class: in \n - text: 资源分享\n link: /categories/资源分享\n class: in\n - text: 学习笔记\n link: /categories/学习笔记\n class: in \n - text: 实用教程\n link: /categories/实用教程\n class: in \n - text: 查看全部\n link: /categories/\n class: in \n footer_friend_links:\n enable: true\n number: 5\n footer_bottom:\n copyright:\n enable: true\n author: Marcus\n link: https://marcus233.top/\n time: 2022\n left:\n - text: 雨云\n desrc: 本站CDN支持\n link: https://rainyun.com/\n - text: 网盾星球\n desrc: 本站CDN防护主要提供商:网盾星球\n link: https://www.netdun.net/\n - text: 萌ICP备20230221\n desrc: 萌ICP备20230221\n link: https://icp.gov.moe/?keyword=20230221\n - text: 萌ICP备20236688\n desrc: 萌ICP备20236688\n link: https://icp.gov.moe/?keyword=20236688\n - text: 萌ICP备20230002\n desrc: 萌ICP备20230002\n link: https://icp.gov.moe/?keyword=20230002\n right:\n - text: Hexo\n desrc: 框架\n link: https://hexo.io/zh-cn/\n - text: Butterfly\n desrc: 主题\n link: https://butterfly.js.org/\n runtime:\n enable: true\n time: 2022/08/09 00:00:00\n footer_css: https://cdn1.tianli0.top/npm/hexo-butterfly-footer-marcus/lib/footer.min.css\n footer_js: https://cdn1.tianli0.top/npm/hexo-butterfly-footer-marcus/lib/footer.min.js\n```\n\n请自行下载footer_js修改建站日期\n如果开启了随机友联,根目录下却没有link.json,请参考(页脚的随机友链)[https://blog.shineyu.cn/footer-random-flink.html]\n\n# 参数释义\n\n| 参数 | 备选值/类型 | 释义 |\n| ------------------------------ | ----------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| enable | true/false | 【必选】控制开关 |\n| priority | number | 【可选】过滤器优先级,数值越小,执行越早,默认为10,选填 |\n| enable_page | path/all | 【可选】填写想要应用的页面的相对路径(即路由地址),如根目录就填’/‘,分类页面就填’/categories/‘。若要应用于所有页面,就填’all’,默认为all |\n| exclude | path | 【可选】填写想要屏蔽的页面,可以多个。仅当enable_page为’all’时生效。写法见示例。原理是将屏蔽项的内容逐个放到当前路径去匹配,若当前路径包含任一屏蔽项,则不会挂载。 |\n| layout.type | id/class | 【可选】挂载容器类型,填写id或class,不填则默认为id |\n| layout.name | text | 【必选】挂载容器名称 |\n| layout.index | 0和正整数 | 【可选】前提是layout.type为class,因为同一页面可能有多个class,此项用来确认究竟排在第几个顺位 |\n| insertposition | text | ‘beforebegin’:元素自身的前面。’afterbegin’:插入元素内部的第一个子节点之前。’beforeend’:插入元素内部的最后一个子节点之后。’afterend’:插入元素自身的后面。 |\n| footer_icons.enable | true/false | 【必选】icon控制开关 |\n| *.text | text | 【必选】显示文字 |\n| *.icon | class | 【必选】icon(例:fa-solid fa-commet) |\n| *.desrc | text | 【必选】a标签内的title选项 |\n| *.class | in/out | 【必选】站内/外链接(站内:in,站外:out) |\n| *.link | url | 【必选】链接 |\n| footer_logo.enable | true/false | 【必选】icon内logo控制开关 |\n| footer_group.enable | true/false | 【必选】group控制开关 |\n| footer_friend_links.enable | true/false | 【必选】随机友联开关 |\n| footer_friend_link.number | 正整数 | 【可选】随机友联数量 |\n| footer_bottom.copyright.enable | true/false | 【必选】copyright开关 |\n| footer_bottom.runtime.enable | true/false | 【必选】网站运行时间开关 |\n| footer_css | url | 【必选】css链接 |\n| footer_js | url | 【必选】js链接 |\n\n使用方法\n填写配置项\n需改动源码的地方\n\n在 `themes\\butterfly\\layout\\includes\\layout.pug`43行(修改页脚背景色的bug)\n\n```pug\n else\n - var footer_bg = ''\n\n- footer#footer(style=footer_bg)\n\n+ footer#footer(style='background: transparent')\n !=partial('includes/footer', {}, {cache: true})\n\n else\n include ./404.pug\n```\n\n 去掉+号\n 在 `themes\\butterfly\\source\\css\\_mode\\darkmode.styl`43行(修改黑暗模式按钮层级的bug)\n\n```\n #web_bg:before,\n\n- #footer:before,\n #page-header:before\n position: absolute\n width: 100%\n height: 100%\n background-color: alpha($dark-black, .7)\n content: ''\n```\n\n# 参考\n\n{%link Marcus的博客,Marcus,https://blog.marcus233.top/p/footer.html%}\n{%link GitHub开源,github@sysicon,https://github.com/sysiocn/hexo-butterfly-footer-marcus%}"}