feat: add CDN to load image resources
This commit is contained in:
parent
6fc57659cb
commit
81a3cbea2a
|
@ -8,7 +8,7 @@
|
|||
<% if (theme.base_info.author || config.author) { %>
|
||||
<div class="article-header">
|
||||
<div class="avatar">
|
||||
<%- image_tag('images/avatar.png') %>
|
||||
<%- __image_tag('images/avatar.png') %>
|
||||
</div>
|
||||
<div class="info">
|
||||
<div class="author">
|
||||
|
|
|
@ -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 `<img src="//cdn.jsdelivr.net/npm/hexo-theme-keep@${this.theme.version}/source/${path}">`
|
||||
} else {
|
||||
return _image_tag(path);
|
||||
}
|
||||
});
|
||||
|
||||
|
|
Loading…
Reference in New Issue