feat: 不再支持 butterfly.yml 寫法
improvement: 文章頁標題改為h1(seo) improvement: 改用hexo 內置的 injector 插入 inject 的代碼 improvement: canonical 改為hexo提供的函數生成 improvement: 優化手機toc 的特效和按鈕出現的時機 remove: 刪除搜索不必要的配置 remove: 移除豆瓣配置,如需配置,請使用 hexo-butterfly-douban fix: 修復上一個版本導致的搜索按鈕在pjax下無法點擊的bugs close #387 fix: 修復上一個版本更新的toc z-index 過低的bugspull/392/head
parent
83b7232841
commit
8014ddb65e
@ -1,5 +1,3 @@
|
||||
if theme.douban && theme.douban.meta && doubanExist
|
||||
meta(name="referrer" content="no-referrer")
|
||||
#article-container
|
||||
if top_img === false
|
||||
h1.page-title= page.title
|
||||
|
@ -1,18 +0,0 @@
|
||||
/**
|
||||
* Note: configs in _data/butterfly.yml will merge configs with hexo.theme.config.
|
||||
*/
|
||||
|
||||
'use strict'
|
||||
|
||||
const { deepMerge } = require('hexo-util')
|
||||
|
||||
hexo.on('generateBefore', function () {
|
||||
const rootConfig = hexo.config
|
||||
if (hexo.locals.get) {
|
||||
const data = hexo.locals.get('data')
|
||||
if (data && data.butterfly) {
|
||||
hexo.theme.config = deepMerge(hexo.theme.config, data.butterfly)
|
||||
}
|
||||
}
|
||||
hexo.theme.config.rootConfig = rootConfig
|
||||
})
|
@ -0,0 +1,22 @@
|
||||
// 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
|
||||
}
|
Loading…
Reference in New Issue