From 3d47319a942b674d5f5619379791989d87f732d2 Mon Sep 17 00:00:00 2001 From: XPoet Date: Mon, 30 Nov 2020 18:25:40 +0800 Subject: [PATCH] fix: fixed a bug where users could not use their own images --- _config.yml | 6 ++++++ layout/_partial/head.ejs | 2 +- layout/article-content.ejs | 2 +- scripts/helpers/helper.js | 19 ------------------- 4 files changed, 8 insertions(+), 21 deletions(-) diff --git a/_config.yml b/_config.yml index e642d12..bfaed82 100644 --- a/_config.yml +++ b/_config.yml @@ -14,6 +14,12 @@ style: # Theme primary color primary_color: '#0066CC' + # Avatar (You can use local image or image external link) + avatar: images/avatar.png + + # Favicon (You can use local image or image external link) + favicon: images/logo.svg + # Image align position, value: left | center img_position: left diff --git a/layout/_partial/head.ejs b/layout/_partial/head.ejs index 9f013aa..f238e36 100644 --- a/layout/_partial/head.ejs +++ b/layout/_partial/head.ejs @@ -23,7 +23,7 @@ <% } %> <%= theme.base_info.title || config.title || 'Keep' %> - <%- __favicon_tag('images/logo.svg') %> + <%- favicon_tag(theme.style.favicon) %> <%- css('css/style') %> <%- __css('css/font-awesome.min.css') %> <%- export_config() %> diff --git a/layout/article-content.ejs b/layout/article-content.ejs index 431bcd5..608f69b 100644 --- a/layout/article-content.ejs +++ b/layout/article-content.ejs @@ -8,7 +8,7 @@ <% if (theme.base_info.author || config.author) { %>
- <%- __image_tag('images/avatar.png') %> + <%- image_tag(theme.style.avatar) %>
diff --git a/scripts/helpers/helper.js b/scripts/helpers/helper.js index af03c19..d023d9d 100644 --- a/scripts/helpers/helper.js +++ b/scripts/helpers/helper.js @@ -73,22 +73,3 @@ hexo.extend.helper.register('__css', function (path) { return _css(path); } }); - -hexo.extend.helper.register('__favicon_tag', function (path) { - const _favicon_tag = hexo.extend.helper.get('favicon_tag').bind(hexo); - if (this.theme.cdn.enable) { - return `` - } else { - return _favicon_tag(path); - } -}); - -hexo.extend.helper.register('__image_tag', function (path) { - const _image_tag = hexo.extend.helper.get('image_tag').bind(hexo); - if (this.theme.cdn.enable) { - return `` - } else { - return _image_tag(path); - } -}); -