diff --git a/layout/article-content.ejs b/layout/article-content.ejs index 26e85c8..431bcd5 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('images/avatar.png') %>
diff --git a/scripts/helpers/helper.js b/scripts/helpers/helper.js index c90231c..af03c19 100644 --- a/scripts/helpers/helper.js +++ b/scripts/helpers/helper.js @@ -72,7 +72,6 @@ hexo.extend.helper.register('__css', function (path) { } else { return _css(path); } - }); hexo.extend.helper.register('__favicon_tag', function (path) { @@ -82,6 +81,14 @@ hexo.extend.helper.register('__favicon_tag', function (path) { } 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); + } });