0%

给hexo-next博客添加石蒜摇摇乐


在\themes\next\ _config.yml中将以下的footer条目取消注释

1
2
custom_file_path:
footer: source/_data/footer.swig

然后在\source\ _data\footer.swig文件(没有则新建)中粘贴以下内容
(代码来源:https://github.com/itorr/sakana

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
<meta name="viewport" content="width=device-width">
<style>

html .sakana-box{
position: fixed;
right: 0;
bottom: 0;

transform-origin: 100% 100%; /* 从右下开始变换 */
}
</style>

<div class="sakana-box"></div>

<script src="https://cdn.jsdelivr.net/npm/sakana@1.0.8"></script>
<script>
// 取消静音
Sakana.setMute(false);

// 启动
Sakana.init({
el: '.sakana-box', // 启动元素 node 或 选择器
scale: .5, // 缩放倍数
canSwitchCharacter: true, // 允许换角色
});
</script>

hexo clean && hexo g && hexo s之后就可以愉快地玩摇摇乐了~