更新日志

2021.7.12:修复bug,适配3.8.1

效果

image-20210311105220717

方法

前往和风天气生成一段代码。

你会得到一段类似这样的代码:

image-20210311105629935

记录下你的key

添加weather.pug

前往ROOT\themes\butterfly\layout\includes

新建weather.pug,填入下列代码:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#he-plugin-standard
script.
WIDGET = {
"CONFIG": {
"layout": 1,
"width": "100%",
"height": "230",
"dataColor": "ffffff",
"background": 1,
"borderRadius": "!{theme.weather.radius}",
"modules": "01",
"key": "!{theme.weather.key}"
}
}
script(src='https://cdn-1.nesxc.com/js/he-standard-common.js')

修改index.pug

打开ROOT\themes\butterfly\layout修改index.pug

include includes/pagination.pug这段的代码后面添加:

1
2
3
4
5
    +postUI
include includes/pagination.pug
if theme.weather.enable
+ .recent-weather(style='width:100%;height:230px')
+ include ./includes/weather.pug
1
2
3
4
5
+postUI
include includes/pagination.pug
if theme.weather.enable
.recent-weather(style='width:100%;height:230px')
include ./includes/weather.pug

修改_confing.butterfly.yml

添加下列代码:

1
2
3
4
5
#天气插件
weather:
enable: true #开关
radius: 8 #圆角-越大越圆
key: youkey #key

把上述代码中的youkey换成你之前生成代码的key即可。

生成

正常的hexo三连就可看到效果了哦~