mirror of
https://github.com/jerryc127/hexo-theme-butterfly.git
synced 2025-09-15 12:58:48 +08:00
🐛 fix: 修復當menu沒設置圖標時,會報Cannot read property 'trim' of undefined 的bug
🐛 fix: 修復meta description 自動生成文章前200文字時部分沒有轉義的bug
This commit is contained in:
parent
6cf59387c8
commit
92111f3c32
@ -3,17 +3,20 @@
|
||||
if !Array.isArray(value)
|
||||
.menus_item
|
||||
a.site-page(href=url_for(trim(value.split('||')[0])))
|
||||
i.fa-fw(class=trim(value.split('||')[1]))
|
||||
if value.split('||')[1]
|
||||
i.fa-fw(class=trim(value.split('||')[1]))
|
||||
span=' '+label
|
||||
else
|
||||
.menus_item
|
||||
a.site-page
|
||||
i.fa-fw(class=trim(label.split('||')[1]) aria-hidden="true")
|
||||
if label.split('||')[1]
|
||||
i.fa-fw(class=trim(label.split('||')[1]) aria-hidden="true")
|
||||
span=' '+ trim(label.split('||')[0])
|
||||
i.fa.fa-chevron-down.menus-expand(aria-hidden="true")
|
||||
ul.menus_item_child
|
||||
each i in value
|
||||
li
|
||||
a.site-page(href=url_for(trim(i.split('||')[1])))
|
||||
i.fa-fw(class=trim(i.split('||')[2]))
|
||||
if i.split('||')[2]
|
||||
i.fa-fw(class=trim(i.split('||')[2]))
|
||||
span=' '+trim(i.split('||')[0])
|
||||
@ -8,16 +8,16 @@
|
||||
|
||||
'use strict'
|
||||
|
||||
const { stripHTML } = require('hexo-util')
|
||||
const { stripHTML, escapeHTML } = require('hexo-util')
|
||||
|
||||
hexo.extend.helper.register('page_description', function () {
|
||||
const { config, page } = this
|
||||
let description = page.description || page.content || page.title || config.description
|
||||
|
||||
if (description) {
|
||||
description = stripHTML(description).substring(0, 200)
|
||||
description = escapeHTML(stripHTML(description).substring(0, 200)
|
||||
.trim()
|
||||
.replace(/\n/g, ' ')
|
||||
).replace(/\n/g, ' ')
|
||||
return description
|
||||
}
|
||||
})
|
||||
|
||||
Loading…
Reference in New Issue
Block a user