mirror of
https://github.com/next-theme/hexo-theme-next.git
synced 2026-01-18 18:33:42 +00:00
Fix changyan undefined
This commit is contained in:
parent
9519ed1733
commit
b27b8ebe44
@ -8,7 +8,7 @@ const { iconText } = require('./common');
|
||||
// Add comment
|
||||
hexo.extend.filter.register('theme_inject', injects => {
|
||||
const config = hexo.theme.config.changyan;
|
||||
if (!config.enable || !config.appid || !config.appkey) return;
|
||||
if (!config || !config.enable || !config.appid || !config.appkey) return;
|
||||
|
||||
injects.comment.raw('changyan', '<div class="comments" id="SOHUCS" sid="{{ gitalk_md5(page.path) }}"></div>', {}, {});
|
||||
|
||||
@ -19,7 +19,7 @@ hexo.extend.filter.register('theme_inject', injects => {
|
||||
// Add post_meta
|
||||
hexo.extend.filter.register('theme_inject', injects => {
|
||||
const config = hexo.theme.config.changyan;
|
||||
if (!config.enable || !config.count || !config.appid || !config.appkey) return;
|
||||
if (!config || !config.enable || !config.count || !config.appid || !config.appkey) return;
|
||||
|
||||
injects.postMeta.raw('changyan', `
|
||||
{% if post.comments %}
|
||||
|
||||
@ -68,7 +68,7 @@ hexo.extend.filter.register('after_generate', () => {
|
||||
}
|
||||
|
||||
// Comments
|
||||
if (!theme.changyan.enable || !theme.changyan.appid || !theme.changyan.appkey) {
|
||||
if (!theme.changyan || !theme.changyan.enable || !theme.changyan.appid || !theme.changyan.appkey) {
|
||||
hexo.route.remove('js/third-party/comments/changyan.js');
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user