mirror of
https://github.com/jerryc127/hexo-theme-butterfly.git
synced 2026-04-10 21:17:07 +08:00
feat: 更新 lazyload 配置,支持原生 lazyload 功能
feat: 代碼優化 feat: 優化 pageType 邏輯 fix: 修復解密文章後, chartjs 沒有加載的 bug
This commit is contained in:
@@ -131,3 +131,17 @@ hexo.extend.helper.register('shuoshuoFN', (data, page) => {
|
||||
|
||||
return finalResult
|
||||
})
|
||||
|
||||
hexo.extend.helper.register('getPageType', (page, isHome) => {
|
||||
const { layout, tag, category, type, archive } = page
|
||||
if (layout) return layout
|
||||
if (tag) return 'tag'
|
||||
if (category) return 'category'
|
||||
if (archive) return 'archive'
|
||||
if (type) {
|
||||
if (type === 'tags' || type === 'categories') return type
|
||||
else return 'page'
|
||||
}
|
||||
if (isHome) return 'home'
|
||||
return 'post'
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user