From 7ffd2f6cdaa37baa4a227f9d9096e989a8885964 Mon Sep 17 00:00:00 2001 From: xaoxuu Date: Mon, 22 Feb 2021 22:03:02 +0800 Subject: [PATCH] fix bugs --- layout/_partial/plugins/comments/utterances/layout.ejs | 3 +++ layout/_partial/plugins/comments/utterances/script.ejs | 2 +- scripts/tags/link.js | 4 ++-- scripts/tags/swiper.js | 1 + source/js/main.js | 1 + 5 files changed, 8 insertions(+), 3 deletions(-) diff --git a/layout/_partial/plugins/comments/utterances/layout.ejs b/layout/_partial/plugins/comments/utterances/layout.ejs index 73ce981..9152395 100644 --- a/layout/_partial/plugins/comments/utterances/layout.ejs +++ b/layout/_partial/plugins/comments/utterances/layout.ejs @@ -11,6 +11,9 @@ function layoutDiv() { } else if (utterances.theme.light) { utterances.theme = utterances.theme.light; } + if (utterances['issue-number']) { + utterances['issue-term'] = null; + } for (let key of Object.keys(utterances)) { if (utterances[key]) { el += ' ' + key + '="' + utterances[key] + '"'; diff --git a/layout/_partial/plugins/comments/utterances/script.ejs b/layout/_partial/plugins/comments/utterances/script.ejs index bf2e0ec..2d808a8 100644 --- a/layout/_partial/plugins/comments/utterances/script.ejs +++ b/layout/_partial/plugins/comments/utterances/script.ejs @@ -11,7 +11,7 @@ } catch (error) {} var script = document.createElement('script'); script.src = 'https://utteranc.es/client.js'; - const keys = ['repo', 'issue-term', 'theme', 'label', 'crossorigin']; + const keys = ['repo', 'issue-term', 'issue-number', 'theme', 'label', 'crossorigin']; keys.forEach((key, i) => { if (el.attributes[key] && el.attributes[key].value) { script.setAttribute(key, el.attributes[key].value); diff --git a/scripts/tags/link.js b/scripts/tags/link.js index d9f2c6d..5a09ac6 100644 --- a/scripts/tags/link.js +++ b/scripts/tags/link.js @@ -1,7 +1,7 @@ /** * link.js v1 | https://github.com/xaoxuu/hexo-theme-stellar/ * 格式与官方标签插件一致使用空格分隔,中括号内的是可选参数(中括号不需要写出来) - * + * * {% link url title [description] [img:src] %} */ @@ -10,7 +10,7 @@ const { ArgsMap } = require('./utils'); hexo.extend.tag.register('link', function(args) { - args = ArgsMap(args, ['src'], ['url', 'title', 'description']); + args = ArgsMap(args, ['img'], ['url', 'title', 'description']); var el = ''; el += '