From 41f0bcb8ab3867725bca35666b976a2c87d41aec Mon Sep 17 00:00:00 2001 From: xaoxuu Date: Sun, 21 Feb 2021 23:20:13 +0800 Subject: [PATCH] fix preload+utterances --- _config.yml | 2 - .../plugins/comments/utterances/layout.ejs | 24 ++++++++++- .../plugins/comments/utterances/script.ejs | 43 ++++--------------- 3 files changed, 32 insertions(+), 37 deletions(-) diff --git a/_config.yml b/_config.yml index 05af435..dbe5608 100755 --- a/_config.yml +++ b/_config.yml @@ -80,8 +80,6 @@ comments: theme: light: github-light dark: github-dark - label: ✨💬✨ - crossorigin: anonymous ######## Footer ######## diff --git a/layout/_partial/plugins/comments/utterances/layout.ejs b/layout/_partial/plugins/comments/utterances/layout.ejs index a447688..73ce981 100644 --- a/layout/_partial/plugins/comments/utterances/layout.ejs +++ b/layout/_partial/plugins/comments/utterances/layout.ejs @@ -1 +1,23 @@ -
+<% +function layoutDiv() { + var el = ''; + el += '
+<%- layoutDiv() %> diff --git a/layout/_partial/plugins/comments/utterances/script.ejs b/layout/_partial/plugins/comments/utterances/script.ejs index a513de4..bf2e0ec 100644 --- a/layout/_partial/plugins/comments/utterances/script.ejs +++ b/layout/_partial/plugins/comments/utterances/script.ejs @@ -1,48 +1,23 @@ -<% -if (page.utterances == undefined) { - page.utterances = theme.comments.utterances; -} else { - for (let key of Object.keys(theme.comments.utterances)) { - if (page.utterances[key] == undefined) { - page.utterances[key] = theme.comments.utterances[key]; - } - } -} -if (page.comment_id) { - page.utterances['issue-term'] = page.comment_id; -} -if (theme.comments.utterances.theme) { - if (page.dark) { - page.utterances.theme = theme.comments.utterances.theme.dark; - } else { - page.utterances.theme = theme.comments.utterances.theme.light; - } -} -%>