From f4c8723a114e45890100c48fd5b808d4eb3265c4 Mon Sep 17 00:00:00 2001 From: xaoxuu Date: Tue, 13 Jul 2021 23:45:34 +0800 Subject: [PATCH] wiki comments --- layout/_partial/plugins/comments/layout.ejs | 17 +++++++++++------ source/css/_layout/partial/related.styl | 8 ++++++++ 2 files changed, 19 insertions(+), 6 deletions(-) diff --git a/layout/_partial/plugins/comments/layout.ejs b/layout/_partial/plugins/comments/layout.ejs index ad4725c..4806905 100644 --- a/layout/_partial/plugins/comments/layout.ejs +++ b/layout/_partial/plugins/comments/layout.ejs @@ -6,11 +6,16 @@ if (theme.comments.service && theme.comments.service.length > 0) { } } // 合并项目评论 -if (loadComment && page.layout == 'wiki' && page.wiki) { - if (page.comment_id == undefined) { - if (theme.comments.service == 'utterances') { - // 使用项目名作为评论issue标题并共享评论数据 - page.comment_id = page.wiki; +if (loadComment && page.layout === 'wiki' && page.wiki) { + let proj = theme.wiki.projects[page.wiki]; + if (proj.comment_id !== undefined && page.comment_id === undefined) { + if (theme.comments.service === 'utterances') { + page.comment_id = proj.comment_id; + } + } + if (proj.comment_title !== undefined && page.comment_title === undefined) { + if (theme.comments.service === 'utterances') { + page.comment_title = proj.comment_title; } } } @@ -18,7 +23,7 @@ if (loadComment && page.layout == 'wiki' && page.wiki) { <% if (loadComment) { %>