mirror of
https://github.com/jerryc127/hexo-theme-butterfly.git
synced 2026-04-16 17:30:53 +08:00
breaking changes: 移除博天api
breaking changes: 移除 waline 的 avatar 和 avatar cdn 配置 feat: anchor 不再限制 post 頁開啟,可以在任何頁面開啟 feat: 文章標題支持點擊跳轉到此標題開始閲讀 closed #653 feat: toc可以設置全部展開 closed #709 feat: 增加 新的評論系統 giscus feat: 支持新的評論名寫法,主題會處理評論名字大小寫,舊的會兼容 feat: 友情鏈接列表增加 fetch url 獲取 improvement: 鼠標移到最新評論內容,增加 title 顯示 fix: 修復 rightside 遮擋內容,導致內容無法點擊的 bug fix: 修復 mermaid 在某些頁面(有元素 id 為 mermaid 時) 會無法加載的 bug fix: 修復 搜索框不會自動 focus 的 bug
This commit is contained in:
@@ -1,12 +1,18 @@
|
||||
/**
|
||||
* Butterfly
|
||||
* CDN
|
||||
* 1. Merge CDN
|
||||
* 2. Capitalize the first letter of comment name
|
||||
*/
|
||||
|
||||
'use strict'
|
||||
|
||||
hexo.extend.filter.register('before_generate', () => {
|
||||
const themeConfig = hexo.theme.config
|
||||
|
||||
/**
|
||||
* Merge CDN
|
||||
*/
|
||||
|
||||
const defaultCDN = {
|
||||
main_css: '/css/index.css',
|
||||
main: '/js/main.js',
|
||||
@@ -24,6 +30,7 @@ hexo.extend.filter.register('before_generate', () => {
|
||||
utterances: 'https://utteranc.es/client.js',
|
||||
twikoo: 'https://cdn.jsdelivr.net/npm/twikoo/dist/twikoo.all.min.js',
|
||||
waline: 'https://cdn.jsdelivr.net/npm/@waline/client/dist/Waline.min.js',
|
||||
giscus: 'https://giscus.app/client.js',
|
||||
|
||||
// share
|
||||
addtoany: 'https://static.addtoany.com/menu/page.js',
|
||||
@@ -101,4 +108,18 @@ hexo.extend.filter.register('before_generate', () => {
|
||||
}
|
||||
|
||||
themeConfig.CDN = Object.assign(defaultCDN, deleteNullValue(themeConfig.CDN))
|
||||
|
||||
/**
|
||||
* Capitalize the first letter of comment name
|
||||
*/
|
||||
|
||||
let { use } = themeConfig.comments
|
||||
|
||||
if (typeof use === 'string') {
|
||||
use = use.split(',')
|
||||
}
|
||||
|
||||
const newArray = use.map(item => item.toLowerCase().replace(/^\S/, s => s.toUpperCase()))
|
||||
|
||||
themeConfig.comments.use = newArray
|
||||
})
|
||||
Reference in New Issue
Block a user