mirror of
https://github.com/jerryc127/hexo-theme-butterfly.git
synced 2026-10-03 22:22:00 +08:00
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 過低的bugs
This commit is contained in:
1 parent
83b7232841
commit
8014ddb65e
34 files changed
+80
-113
No files matched your search
@@ -9,4 +9,13 @@ hexo.extend.filter.register('before_generate', () => {
|
||||
logger.error('請把 Hexo 升級到 V5.0.0 或更高的版本!')
|
||||
process.exit(-1)
|
||||
}
|
||||
|
||||
if (hexo.locals.get) {
|
||||
const data = hexo.locals.get('data')
|
||||
if (data && data.butterfly) {
|
||||
logger.error(" 'butterfly.yml' is deprecated. Please use '_config.butterfly.yml' ")
|
||||
logger.error(" 'butterfly.yml' 已經棄用,請使用 '_config.butterfly.yml' ")
|
||||
process.exit(-1)
|
||||
}
|
||||
}
|
||||
})
|
||||
@@ -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
|
||||
})
|
||||
@@ -6,7 +6,8 @@
|
||||
'use strict'
|
||||
|
||||
hexo.extend.filter.register('before_post_render', function (data) {
|
||||
if (hexo.theme.config.rootConfig.post_asset_folder) {
|
||||
const { config } = this
|
||||
if (config.post_asset_folder) {
|
||||
const imgTestReg = /\.(png|jpe?g|gif|svg|webp)(\?.*)?$/
|
||||
const topImg = data.top_img
|
||||
const cover = data.cover
|
||||
|
||||
Loaded 3 of 34 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user