mirror of
https://github.com/jerryc127/hexo-theme-butterfly.git
synced 2026-06-06 05:11:45 +08:00
fix: 退回之前的inject實現,解決上一個版本導致無法插入inject的bugs close #390
This commit is contained in:
@@ -61,3 +61,12 @@ hexo.extend.helper.register('urlNoIndex', function () {
|
||||
hexo.extend.helper.register('md5', function (path) {
|
||||
return crypto.createHash('md5').update(decodeURI(this.url_for(path))).digest('hex')
|
||||
})
|
||||
|
||||
hexo.extend.helper.register('injectHtml', function (data) {
|
||||
let result = ''
|
||||
if (!data) return ''
|
||||
for (let i = 0; i < data.length; i++) {
|
||||
result += data[i]
|
||||
}
|
||||
return result
|
||||
})
|
||||
|
||||
@@ -1,22 +0,0 @@
|
||||
// Injector
|
||||
|
||||
'use strict'
|
||||
|
||||
hexo.extend.injector.register('head_end', function () {
|
||||
const data = hexo.config.theme_config && hexo.config.theme_config.inject.head
|
||||
return genResult(data)
|
||||
})
|
||||
|
||||
hexo.extend.injector.register('body_end', () => {
|
||||
const data = hexo.config.theme_config && hexo.config.theme_config.inject.bottom
|
||||
return genResult(data)
|
||||
})
|
||||
|
||||
function genResult (data) {
|
||||
let result = ''
|
||||
if (!data) return ''
|
||||
for (let i = 0; i < data.length; i++) {
|
||||
result += data[i]
|
||||
}
|
||||
return result
|
||||
}
|
||||
Reference in New Issue
Block a user