mirror of
https://github.com/next-theme/hexo-theme-next.git
synced 2026-01-19 18:42:34 +00:00
Warning of leancloud_visitors
This commit is contained in:
parent
7b91f8ee74
commit
acc5a74268
@ -97,7 +97,7 @@
|
||||
{%- endif %}
|
||||
|
||||
{# LeanCloud PageView #}
|
||||
{%- if theme.leancloud_visitors.enable or (theme.valine.enable and theme.valine.appId and theme.valine.appKey and theme.valine.visitor) %}
|
||||
{%- if theme.leancloud_visitors.enable or (theme.valine.enable and theme.valine.visitor) %}
|
||||
<span id="{{ url_for(post.path) }}" class="post-meta-item leancloud_visitors" data-flag-title="{{ post.title }}" title="{{ __('post.views') }}">
|
||||
<span class="post-meta-item-icon">
|
||||
<i class="fa fa-eye"></i>
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
{%- if theme.leancloud_visitors.enable and not theme.valine.visitor %}
|
||||
{%- if theme.leancloud_visitors.enable %}
|
||||
<script{{ pjax }}>
|
||||
(function() {
|
||||
function leancloudSelector(url) {
|
||||
|
||||
@ -14,15 +14,23 @@ module.exports = hexo => {
|
||||
hexo.theme.config = merge(hexo.theme.config, hexo.config.theme_config);
|
||||
}
|
||||
|
||||
const { cache, language_switcher } = hexo.theme.config;
|
||||
const { cache, language_switcher, leancloud_visitors, valine } = hexo.theme.config;
|
||||
const warning = function(...args) {
|
||||
hexo.log.warn(`Since ${args[0]} is turned on, the ${args[1]} is disabled to avoid potential hazards.`);
|
||||
};
|
||||
|
||||
if (cache && cache.enable && language_switcher) {
|
||||
hexo.log.warn('Since language_switcher is turned on, the caching is disabled to avoid potential hazards.');
|
||||
warning('language_switcher', 'caching');
|
||||
cache.enable = false;
|
||||
}
|
||||
if (cache && cache.enable && hexo.config.relative_link) {
|
||||
hexo.log.warn('Since caching is turned on, the `relative_link` option in Hexo `_config.yml` is set to `false` to avoid potential hazards.');
|
||||
warning('caching', '`relative_link` option in Hexo `_config.yml`');
|
||||
hexo.config.relative_link = false;
|
||||
}
|
||||
if (leancloud_visitors && leancloud_visitors.enable && valine && valine.enable && valine.visitor) {
|
||||
warning('valine.visitor', 'leancloud_visitors');
|
||||
leancloud_visitors.enable = false;
|
||||
}
|
||||
hexo.config.meta_generator = false;
|
||||
|
||||
// Custom languages support. Introduced in NexT v6.3.0.
|
||||
|
||||
@ -5,11 +5,11 @@
|
||||
const keys = ['toc', 'reward_settings', 'quicklink'];
|
||||
|
||||
hexo.extend.filter.register('template_locals', locals => {
|
||||
const { env, config } = hexo;
|
||||
const { version, config } = hexo;
|
||||
const { __, theme, page } = locals;
|
||||
const { i18n } = hexo.theme;
|
||||
// Hexo & NexT version
|
||||
locals.hexo_version = env.version;
|
||||
locals.hexo_version = version;
|
||||
locals.next_version = require('../../package.json').version;
|
||||
// Language & Config
|
||||
locals.title = __('title') !== 'title' ? __('title') : config.title;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user