通过修改主题文件添加
添加itorr/sakana: 🐟「Sakana!」石蒜模拟器 (github.com)
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
| #footer-wrap if theme.footer.owner.enable - var now = new Date() - var nowYear = now.getFullYear() if theme.footer.owner.since && theme.footer.owner.since != nowYear .copyright!= `©${theme.footer.owner.since} - ${nowYear} By ${config.author}` else .copyright!= `©${nowYear} By ${config.author}` if theme.footer.copyright .framework-info span= _p('footer.framework') + ' ' a(href='https://hexo.io')= 'Hexo' span.footer-separator | span= _p('footer.theme') + ' ' a(href='https://github.com/jerryc127/hexo-theme-butterfly')= 'Butterfly' if theme.footer.custom_text .footer_custom_text!=`${theme.footer.custom_text}` div(class="sakana-box" style='position:fixed;bottom:10px;right:10px;transform-origin: 100% 100%;') script. function initSakanaTest() { Sakana.init({ el: '.sakana-box', scale: .5, character: 'chisato', canSwitchCharacter: true, }) Sakana.setMute(false); } script(onload = 'initSakanaTest()' src="https://cdn.jsdelivr.net/npm/sakana")
|
通过插件添加
概述
使用衍生版本 🐟「Sakana! Widget」
此 Hexo 插件用于在渲染 HTML 时将 Sakana! Widget 组件注入进 body 内,以非侵入式方式加载石蒜组件。
安装
1
| npm install hexo-sakana --save
|
配置
在 _config.yml 或 _config.[theme].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
| sakana: character: takina enable: true enable_mobile: false size: 200 autoFit: false bottom: 0px controls: true stroke: color: "#b4b4b4" width: 10 threshold: 0.1 rotate: 0
|
配置文件参考:https://github.com/dsrkafuu/sakana-widget/blob/main/README.zh.md