[fix] icon #376
This commit is contained in:
parent
a2f429a4e9
commit
48afb63f4c
|
@ -115,7 +115,7 @@ function layoutFooterDiv() {
|
|||
el += ' onclick="' + item.onclick + '"';
|
||||
}
|
||||
el += '>';
|
||||
el += item.icon;
|
||||
el += icon(item.icon, 'no-lazy')
|
||||
el += '</a>';
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,13 +12,7 @@ function layoutDiv() {
|
|||
}
|
||||
el += `>`
|
||||
if (item.icon?.length > 0) {
|
||||
if (item.icon.startsWith('<')) {
|
||||
el += item.icon
|
||||
} else if (theme.icons[item.icon]) {
|
||||
el += theme.icons[item.icon]
|
||||
} else {
|
||||
el += `<img no-lazy src="${item.icon}">`
|
||||
}
|
||||
el += icon(item.icon, 'no-lazy')
|
||||
} else {
|
||||
el += `<span>${__(item.title)}</span>`
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
'use strict';
|
||||
|
||||
hexo.extend.helper.register('icon', function(key) {
|
||||
hexo.extend.helper.register('icon', function(key, args) {
|
||||
const { icons } = hexo.theme.config
|
||||
var result = ''
|
||||
if (icons[key]) {
|
||||
|
@ -9,7 +9,7 @@ hexo.extend.helper.register('icon', function(key) {
|
|||
result = key
|
||||
}
|
||||
if (result.startsWith('/') || result.startsWith('https://') || result.startsWith('http://')) {
|
||||
return `<img src="${result}" />`
|
||||
return `<img ${args?.length > 0 ? args : ''} src="${result}" />`
|
||||
} else {
|
||||
return result
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue