wiki comments

This commit is contained in:
xaoxuu 2021-07-13 23:45:34 +08:00
parent 5143c55478
commit f4c8723a11
2 changed files with 19 additions and 6 deletions

View File

@ -6,11 +6,16 @@ if (theme.comments.service && theme.comments.service.length > 0) {
} }
} }
// 合并项目评论 // 合并项目评论
if (loadComment && page.layout == 'wiki' && page.wiki) { if (loadComment && page.layout === 'wiki' && page.wiki) {
if (page.comment_id == undefined) { let proj = theme.wiki.projects[page.wiki];
if (theme.comments.service == 'utterances') { if (proj.comment_id !== undefined && page.comment_id === undefined) {
// 使用项目名作为评论issue标题并共享评论数据 if (theme.comments.service === 'utterances') {
page.comment_id = page.wiki; 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) { %> <% if (loadComment) { %>
<div class='related-wrap md reveal' id="comments"> <div class='related-wrap md reveal' id="comments">
<div class='cmt-title cap theme'> <div class='cmt-title cap theme'>
<%- page.comment_title != undefined ? page.comment_title : __('meta.comment_title') %> <%- page.comment_title !== undefined ? markdown(page.comment_title) : __('meta.comment_title') %>
</div> </div>
<div class='cmt-body <%- theme.comments.service %>'> <div class='cmt-body <%- theme.comments.service %>'>
<%- partial(theme.comments.service + '/layout') %> <%- partial(theme.comments.service + '/layout') %>

View File

@ -124,6 +124,14 @@
.related-wrap#comments .related-wrap#comments
div.cmt-title
p
margin: 0
a
color: inherit
text-decoration: underline
&:hover
color: $color-hover
div.cmt-body div.cmt-body
min-height: 150px min-height: 150px
position: relative position: relative