Skip to content

Commit b27b8eb

Browse files
Fix changyan undefined
1 parent 9519ed1 commit b27b8eb

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

scripts/filters/comment/changyan.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ const { iconText } = require('./common');
88
// Add comment
99
hexo.extend.filter.register('theme_inject', injects => {
1010
const config = hexo.theme.config.changyan;
11-
if (!config.enable || !config.appid || !config.appkey) return;
11+
if (!config || !config.enable || !config.appid || !config.appkey) return;
1212

1313
injects.comment.raw('changyan', '<div class="comments" id="SOHUCS" sid="{{ gitalk_md5(page.path) }}"></div>', {}, {});
1414

@@ -19,7 +19,7 @@ hexo.extend.filter.register('theme_inject', injects => {
1919
// Add post_meta
2020
hexo.extend.filter.register('theme_inject', injects => {
2121
const config = hexo.theme.config.changyan;
22-
if (!config.enable || !config.count || !config.appid || !config.appkey) return;
22+
if (!config || !config.enable || !config.count || !config.appid || !config.appkey) return;
2323

2424
injects.postMeta.raw('changyan', `
2525
{% if post.comments %}

scripts/filters/minify.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ hexo.extend.filter.register('after_generate', () => {
6868
}
6969

7070
// Comments
71-
if (!theme.changyan.enable || !theme.changyan.appid || !theme.changyan.appkey) {
71+
if (!theme.changyan || !theme.changyan.enable || !theme.changyan.appid || !theme.changyan.appkey) {
7272
hexo.route.remove('js/third-party/comments/changyan.js');
7373
}
7474

0 commit comments

Comments
 (0)