fixed theme resource reference path error (#77)

This commit is contained in:
XPoet 2021-03-29 10:22:56 +08:00
parent d2e56096b7
commit 82eebcda82
2 changed files with 5 additions and 4 deletions

View File

@ -27,7 +27,7 @@
<% } %>
<%= theme.base_info.title || config.title || 'Keep Theme' %>
</title>
<link rel="stylesheet" href="/css/style.css">
<%- css('css/style') %>
<%- favicon_tag(theme.style.favicon) %>
<%- __css('css/font-awesome.min.css') %>
<%- export_config() %>

View File

@ -51,11 +51,11 @@ hexo.extend.helper.register('getPostUrl', function (rootUrl, path) {
});
hexo.extend.helper.register('__js', function (path) {
const _js = hexo.extend.helper.get('js').bind(hexo);
const cdnPathHandle = (path_2) => {
return this.theme.cdn.enable
? `<script src="//cdn.jsdelivr.net/npm/hexo-theme-keep@${this.theme.version}/source/${path_2}"></script>`
: `<script src="/${path_2}"></script>`;
: _js(path_2);
}
let t = ``;
@ -72,9 +72,10 @@ hexo.extend.helper.register('__js', function (path) {
});
hexo.extend.helper.register('__css', function (path) {
const _css = hexo.extend.helper.get('css').bind(hexo);
if (this.theme.cdn.enable) {
return `<link rel="stylesheet" href="//cdn.jsdelivr.net/npm/hexo-theme-keep@${this.theme.version}/source/${path}">`;
} else {
return `<link rel="stylesheet" href="/${path}">`
return _css(path);
}
});