用于butterfly主题

创建文件夹

博客主目录下的source目录下分别创建好cssjsimg文件夹。

引入自定义的js、css文件

主题配置文件(_config.butterfly.yml)中找到配置inject:

1
2
3
4
5
6
7
8
9
10
11
12
# Inject
# ps:引入自定义css、js
# css文件在head引入,js文件在bottom里引入,有的js要求在head引入,不然无法生效
# Insert the code to head (before '</head>' tag) and the bottom (before '</body>' tag)
# ps: 插入代码到头部 </head> 之前 和 底部 </body> 之前
inject:
head: #注入自定义css
- <link rel="stylesheet" href="/css/style.css?v1">
# - <link rel="stylesheet" href="/xxx.css">
bottom: #注入自定义js
- <script src="/js/script.js?v1"></script>
# - <script src="/xxxx"></script>

引入多个文件

1
2
3
4
bottom: #注入自定义js
- <script src="/js/script.js?v1"></script>
- <script src="/xxxx"></script>
# 路径是/xxx/xxx 没有./xxx/xxx