diff --git a/_config.yml b/_config.yml index d692d50..475f136 100644 --- a/_config.yml +++ b/_config.yml @@ -936,3 +936,9 @@ vendors: # Canvas ribbon canvas_ribbon: + +# Assets +# Accelerate delivery of static files using a CDN +css: css +js: js +images: images diff --git a/layout/_macro/post.njk b/layout/_macro/post.njk index 20c9282..891be3e 100644 --- a/layout/_macro/post.njk +++ b/layout/_macro/post.njk @@ -9,7 +9,7 @@ diff --git a/layout/_partials/head/head.njk b/layout/_partials/head/head.njk index 1adb5f3..949a476 100644 --- a/layout/_partials/head/head.njk +++ b/layout/_partials/head/head.njk @@ -38,7 +38,7 @@ {%- endif %} - + {{ next_font() }} diff --git a/layout/_partials/sidebar/site-overview.njk b/layout/_partials/sidebar/site-overview.njk index 5faedd6..73fa566 100644 --- a/layout/_partials/sidebar/site-overview.njk +++ b/layout/_partials/sidebar/site-overview.njk @@ -89,7 +89,7 @@ {%- if theme.creative_commons.license and theme.creative_commons.sidebar %}
- {%- set ccImage = 'Creative Commons' %} + {%- set ccImage = 'Creative Commons' %} {{ next_url(ccURL, ccImage, {class: 'cc-opacity'}) }}
{%- endif %} diff --git a/scripts/helpers/engine.js b/scripts/helpers/engine.js index e20afdc..e4a0597 100644 --- a/scripts/helpers/engine.js +++ b/scripts/helpers/engine.js @@ -19,7 +19,7 @@ hexo.extend.helper.register('next_js', function(file, pjax = false) { const { next_version } = this; const { internal } = this.theme.vendors; const links = { - local : this.url_for(`js/${file}`), + local : this.url_for(`${this.theme.js}/${file}`), jsdelivr: `//cdn.jsdelivr.net/npm/hexo-theme-next@${next_version}/source/js/${file}`, unpkg : `//unpkg.com/hexo-theme-next@${next_version}/source/js/${file}`, cdnjs : `//cdnjs.cloudflare.com/ajax/libs/hexo-theme-next/${next_version}/${file}` @@ -60,9 +60,9 @@ hexo.extend.helper.register('post_gallery', function(photos) { }); hexo.extend.helper.register('post_edit', function(src) { - const { theme } = this; - if (!theme.post_edit.enable) return ''; - return this.next_url(theme.post_edit.url + src, '', { + const { post_edit } = this.theme; + if (!post_edit.enable) return ''; + return this.next_url(post_edit.url + src, '', { class: 'post-edit-link', title: this.__('post.edit') }); diff --git a/scripts/helpers/next-config.js b/scripts/helpers/next-config.js index 010a5ce..36819bb 100644 --- a/scripts/helpers/next-config.js +++ b/scripts/helpers/next-config.js @@ -8,10 +8,11 @@ const { parse } = require('url'); * Export theme config to js */ hexo.extend.helper.register('next_config', function() { - const { config, theme, __ } = this; + const { config, theme, url_for, __ } = this; const exportConfig = { hostname : parse(config.url).hostname || config.url, root : config.root, + images : url_for(theme.images), scheme : theme.scheme, version : this.next_version, exturl : theme.exturl, @@ -41,7 +42,7 @@ hexo.extend.helper.register('next_config', function() { }; } if (config.search && theme.local_search && theme.local_search.enable) { - exportConfig.path = this.url_for(config.search.path); + exportConfig.path = url_for(config.search.path); exportConfig.localsearch = theme.local_search; } return `