mirror of
https://github.com/next-theme/hexo-theme-next.git
synced 2026-01-17 18:22:33 +00:00
New variable CONFIG.images
This commit is contained in:
parent
3640946f60
commit
88b4ae077a
@ -936,3 +936,9 @@ vendors:
|
||||
|
||||
# Canvas ribbon
|
||||
canvas_ribbon:
|
||||
|
||||
# Assets
|
||||
# Accelerate delivery of static files using a CDN
|
||||
css: css
|
||||
js: js
|
||||
images: images
|
||||
|
||||
@ -9,7 +9,7 @@
|
||||
<link itemprop="mainEntityOfPage" href="{{ post.permalink }}">
|
||||
|
||||
<span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
|
||||
<meta itemprop="image" content="{{ url_for(theme.avatar.url or 'images/avatar.gif') }}">
|
||||
<meta itemprop="image" content="{{ url_for(theme.avatar.url or theme.images + '/avatar.gif') }}">
|
||||
<meta itemprop="name" content="{{ author }}">
|
||||
<meta itemprop="description" content="{{ description }}">
|
||||
</span>
|
||||
|
||||
@ -38,7 +38,7 @@
|
||||
<meta name="baidu-site-verification" content="{{ theme.baidu_site_verification }}">
|
||||
{%- endif %}
|
||||
|
||||
<link rel="stylesheet" href="{{ url_for('css/main.css') }}">
|
||||
<link rel="stylesheet" href="{{ url_for(theme.css) }}/main.css">
|
||||
|
||||
{{ next_font() }}
|
||||
|
||||
|
||||
@ -89,7 +89,7 @@
|
||||
|
||||
{%- if theme.creative_commons.license and theme.creative_commons.sidebar %}
|
||||
<div class="cc-license site-overview-item animated" itemprop="license">
|
||||
{%- set ccImage = '<img src="' + url_for('images/cc-' + theme.creative_commons.license + '.svg') + '" alt="Creative Commons">' %}
|
||||
{%- set ccImage = '<img src="' + url_for(theme.images + '/cc-' + theme.creative_commons.license + '.svg') + '" alt="Creative Commons">' %}
|
||||
{{ next_url(ccURL, ccImage, {class: 'cc-opacity'}) }}
|
||||
</div>
|
||||
{%- endif %}
|
||||
|
||||
@ -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, '<i class="fa fa-pen-nib"></i>', {
|
||||
const { post_edit } = this.theme;
|
||||
if (!post_edit.enable) return '';
|
||||
return this.next_url(post_edit.url + src, '<i class="fa fa-pen-nib"></i>', {
|
||||
class: 'post-edit-link',
|
||||
title: this.__('post.edit')
|
||||
});
|
||||
|
||||
@ -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 `<script class="hexo-configurations">
|
||||
|
||||
@ -43,7 +43,7 @@ document.addEventListener('DOMContentLoaded', () => {
|
||||
.replace(/\$\{hits}/, data.nbHits)
|
||||
.replace(/\$\{time}/, data.processingTimeMS);
|
||||
return `<span>${stats}</span>
|
||||
<img src="${CONFIG.root}images/logo-algolia-nebula-blue-full.svg" alt="Algolia">`;
|
||||
<img src="${CONFIG.images}/logo-algolia-nebula-blue-full.svg" alt="Algolia">`;
|
||||
}
|
||||
},
|
||||
cssClasses: {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user