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:
Jerry
2020-10-15 00:14:38 +08:00
parent 83b7232841
commit 8014ddb65e
34 changed files with 80 additions and 113 deletions

View File

@@ -2,13 +2,12 @@
* Butterfly
* @example
* page_description()
* injectHtml(data)
* cloudTags(source, minfontsize, maxfontsize, limit)
*/
'use strict'
const { stripHTML, escapeHTML } = require('hexo-util')
const { stripHTML, escapeHTML, prettyUrls } = require('hexo-util')
const crypto = require('crypto')
hexo.extend.helper.register('page_description', function () {
@@ -23,15 +22,6 @@ hexo.extend.helper.register('page_description', function () {
}
})
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
})
hexo.extend.helper.register('cloudTags', function (options = {}) {
const env = this
let source = options.source
@@ -65,12 +55,7 @@ hexo.extend.helper.register('cloudTags', function (options = {}) {
})
hexo.extend.helper.register('urlNoIndex', function () {
const { permalink } = hexo.config
let url = this.url.replace(/index\.html$/, '')
if (!permalink.endsWith('.html')) {
url = url.replace(/\.html$/, '')
}
return url
return prettyUrls(this.url, { trailing_index: false, trailing_html: false })
})
hexo.extend.helper.register('md5', function (path) {