-
+
<%- __('page.error.what') %>
diff --git a/layout/_partial/main/article/article_footer.ejs b/layout/_partial/main/article/article_footer.ejs
index dc06e9b..46e9946 100644
--- a/layout/_partial/main/article/article_footer.ejs
+++ b/layout/_partial/main/article/article_footer.ejs
@@ -113,15 +113,7 @@ function layoutDiv() {
el += ' onclick="util.copy("copy-link", "' + __('message.copied') + '")"';
}
el += '>';
- if (item == 'wechat') {
- el += '';
- } else if (item == 'weibo') {
- el += '';
- } else if (item == 'email') {
- el += '';
- } else if (item == 'link') {
- el += '';
- }
+ el += icon(`share:${item}`)
el += '';
}
});
diff --git a/layout/_partial/main/navbar/author_banner.ejs b/layout/_partial/main/navbar/author_banner.ejs
index 58e68f5..2406197 100644
--- a/layout/_partial/main/navbar/author_banner.ejs
+++ b/layout/_partial/main/navbar/author_banner.ejs
@@ -10,9 +10,7 @@ function layoutDiv() {
diff --git a/layout/_partial/main/navbar/breadcrumb.ejs b/layout/_partial/main/navbar/breadcrumb.ejs
index dab3c6b..5686c2f 100644
--- a/layout/_partial/main/navbar/breadcrumb.ejs
+++ b/layout/_partial/main/navbar/breadcrumb.ejs
@@ -121,15 +121,15 @@ function layoutDiv() {
el += `
diff --git a/layout/_partial/main/post_list/post_card.ejs b/layout/_partial/main/post_list/post_card.ejs
index 86bf456..16a2f0d 100755
--- a/layout/_partial/main/post_list/post_card.ejs
+++ b/layout/_partial/main/post_list/post_card.ejs
@@ -91,7 +91,7 @@ function div_default() {
}
}
if (post.pin) {
- el += '
';
+ el += `
${icon('default:pin')}`
}
el += '
';
el += '';
diff --git a/layout/_partial/menubtn.ejs b/layout/_partial/menubtn.ejs
index 64a91a0..dcdfdd7 100644
--- a/layout/_partial/menubtn.ejs
+++ b/layout/_partial/menubtn.ejs
@@ -1,5 +1,5 @@
diff --git a/layout/_partial/plugins/comments/artalk/layout.ejs b/layout/_partial/plugins/comments/artalk/layout.ejs
index fb82fd7..3304b0c 100644
--- a/layout/_partial/plugins/comments/artalk/layout.ejs
+++ b/layout/_partial/plugins/comments/artalk/layout.ejs
@@ -11,7 +11,7 @@ function layoutDiv() {
el += ' ' + key + '="' + cfg[key] + '"';
}
}
- el += '>
';
+ el += `>${icon('default:loading')}`
return el;
}
%>
diff --git a/layout/_partial/plugins/comments/beaudar/layout.ejs b/layout/_partial/plugins/comments/beaudar/layout.ejs
index 48dc222..d386fd3 100644
--- a/layout/_partial/plugins/comments/beaudar/layout.ejs
+++ b/layout/_partial/plugins/comments/beaudar/layout.ejs
@@ -17,6 +17,6 @@ function layoutDiv() {
}
%>
-
+<%- icon('default:loading') %>
<%- layoutDiv() %>
diff --git a/layout/_partial/plugins/comments/giscus/layout.ejs b/layout/_partial/plugins/comments/giscus/layout.ejs
index 48dc222..d386fd3 100644
--- a/layout/_partial/plugins/comments/giscus/layout.ejs
+++ b/layout/_partial/plugins/comments/giscus/layout.ejs
@@ -17,6 +17,6 @@ function layoutDiv() {
}
%>
-
+<%- icon('default:loading') %>
<%- layoutDiv() %>
diff --git a/layout/_partial/plugins/comments/twikoo/layout.ejs b/layout/_partial/plugins/comments/twikoo/layout.ejs
index adbd043..60f10f1 100644
--- a/layout/_partial/plugins/comments/twikoo/layout.ejs
+++ b/layout/_partial/plugins/comments/twikoo/layout.ejs
@@ -11,7 +11,7 @@ function layoutDiv() {
el += ' ' + key + '="' + cfg[key] + '"';
}
}
- el += '>';
+ el += `>${icon('default:loading')}`
return el;
}
%>
diff --git a/layout/_partial/plugins/comments/utterances/layout.ejs b/layout/_partial/plugins/comments/utterances/layout.ejs
index 48dc222..d386fd3 100644
--- a/layout/_partial/plugins/comments/utterances/layout.ejs
+++ b/layout/_partial/plugins/comments/utterances/layout.ejs
@@ -17,6 +17,6 @@ function layoutDiv() {
}
%>
-
+<%- icon('default:loading') %>
<%- layoutDiv() %>
diff --git a/layout/_partial/plugins/comments/waline/layout.ejs b/layout/_partial/plugins/comments/waline/layout.ejs
index 9142395..f725768 100644
--- a/layout/_partial/plugins/comments/waline/layout.ejs
+++ b/layout/_partial/plugins/comments/waline/layout.ejs
@@ -11,7 +11,7 @@ function layoutDiv() {
el += ' ' + key + '="' + cfg[key] + '"';
}
}
- el += '>';
+ el += `>${icon('default:loading')}`
return el;
}
%>
diff --git a/layout/_partial/sidebar/menu.ejs b/layout/_partial/sidebar/menu.ejs
index bfc59cb..613e8aa 100644
--- a/layout/_partial/sidebar/menu.ejs
+++ b/layout/_partial/sidebar/menu.ejs
@@ -14,6 +14,8 @@ function layoutDiv() {
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 += ``
}
diff --git a/layout/_partial/sidebar/search.ejs b/layout/_partial/sidebar/search.ejs
index eb03635..1ad124d 100644
--- a/layout/_partial/sidebar/search.ejs
+++ b/layout/_partial/sidebar/search.ejs
@@ -20,7 +20,7 @@ function layoutDiv() {
}
}
el += ``
- el += ``
+ el += icon('default:search')
el += ``
el += ` 0) {
diff --git a/layout/_partial/widgets/ghrepo.ejs b/layout/_partial/widgets/ghrepo.ejs
index 195e753..c3c13e5 100644
--- a/layout/_partial/widgets/ghrepo.ejs
+++ b/layout/_partial/widgets/ghrepo.ejs
@@ -22,21 +22,21 @@ function layoutDiv() {
el += '';
// follow
el += '';
- el += '';
+ el += icon('github:logo')
el += 'Follow';
el += '';
el += '';
diff --git a/layout/_partial/widgets/recent.ejs b/layout/_partial/widgets/recent.ejs
index 495b3f9..d609eff 100644
--- a/layout/_partial/widgets/recent.ejs
+++ b/layout/_partial/widgets/recent.ejs
@@ -6,7 +6,7 @@ function layoutDiv() {
el += '' + __("meta.recent_update") + '';
if (item.rss) {
el += '';
}
el += '';
@@ -41,7 +41,7 @@ function layoutDiv() {
}
el += (post.title || post.wiki) + '';
if (isActive) {
- el += ``
+ el += icon('default:bookmark')
}
el += '';
el += '';
diff --git a/layout/_partial/widgets/related.ejs b/layout/_partial/widgets/related.ejs
index 2df6f0b..9a482e9 100644
--- a/layout/_partial/widgets/related.ejs
+++ b/layout/_partial/widgets/related.ejs
@@ -18,7 +18,7 @@ function relatedPostsInTopic() {
el += ``
el += `${post.title}`
if (isActive) {
- el += ``
+ el += icon('default:bookmark')
}
el += ``
}
diff --git a/layout/_partial/widgets/toc.ejs b/layout/_partial/widgets/toc.ejs
index c9c3c70..81b3548 100644
--- a/layout/_partial/widgets/toc.ejs
+++ b/layout/_partial/widgets/toc.ejs
@@ -41,7 +41,7 @@ function layoutDocTree(pages) {
el += ``
el += `${p.title}`
if (isActive.length > 0) {
- el += ``
+ el += icon('default:bookmark')
}
el += ``
}
diff --git a/scripts/events/lib/config.js b/scripts/events/lib/config.js
index b48b85b..f8c1fb5 100644
--- a/scripts/events/lib/config.js
+++ b/scripts/events/lib/config.js
@@ -29,7 +29,7 @@ module.exports = ctx => {
// merge data
const data = ctx.locals.get('data')
- // merge widgets
+ // merge widgets: 可覆盖删除的合并
var widgets = ctx.render.renderSync({ path: path.join(ctx.theme_dir, '_data/widgets.yml'), engine: 'yaml' })
if (data.widgets) {
for (let i of Object.keys(data.widgets)) {
@@ -50,9 +50,15 @@ module.exports = ctx => {
}
}
}
-
ctx.theme.config.widgets = widgets
+ // merge icons: 简单覆盖合并
+ var icons = ctx.render.renderSync({ path: path.join(ctx.theme_dir, '_data/icons.yml'), engine: 'yaml' })
+ if (data.icons) {
+ icons = Object.assign({}, icons, data.icons)
+ }
+ ctx.theme.config.icons = icons
+
// default menu
if (ctx.theme.config.menubar == undefined) {
ctx.theme.config.menubar = {}
diff --git a/scripts/helpers/icon.js b/scripts/helpers/icon.js
new file mode 100644
index 0000000..eb9830a
--- /dev/null
+++ b/scripts/helpers/icon.js
@@ -0,0 +1,16 @@
+'use strict';
+
+hexo.extend.helper.register('icon', function(args){
+ const { icons } = hexo.theme.config
+ var result = ''
+ if (icons[args]) {
+ result = icons[args]
+ } else {
+ result = args
+ }
+ if (result.startsWith('/') || result.startsWith('https://') || result.startsWith('http://')) {
+ return ``
+ } else {
+ return result
+ }
+})
diff --git a/source/css/_layout/list.styl b/source/css/_layout/list.styl
index 80e9fff..89db0a3 100644
--- a/source/css/_layout/list.styl
+++ b/source/css/_layout/list.styl
@@ -52,6 +52,9 @@
img
object-fit: contain
height: 1.5em
+ svg
+ height: 1.5rem
+ color: $c-red
.post-list .post-card:hover
img
diff --git a/source/css/_layout/partial/paginator.styl b/source/css/_layout/partial/paginator.styl
index 8d2a107..03a93ca 100644
--- a/source/css/_layout/partial/paginator.styl
+++ b/source/css/_layout/partial/paginator.styl
@@ -28,10 +28,10 @@
background-clip: content-box
&.next
border-left: 1px dashed var(--block-border)
- background-image: url('https://gcore.jsdelivr.net/gh/cdn-x/placeholder@1.0.12/arrow/064b95430caf4.svg')
+ background-image: url(hexo-config('style.paginator.next'))
&.prev
border-right: 1px dashed var(--block-border)
- background-image: url('https://gcore.jsdelivr.net/gh/cdn-x/placeholder@1.0.12/arrow/f049bbd4e88ec.svg')
+ background-image: url(hexo-config('style.paginator.prev'))
.current
font-family: $ff-code
background: var(--block)