Skip to content

Commit

Permalink
fix: 评论异常
Browse files Browse the repository at this point in the history
  • Loading branch information
D-Sketon committed Apr 4, 2024
1 parent a3fbc25 commit 7aa4d4d
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 11 deletions.
2 changes: 1 addition & 1 deletion layout/_partial/after-footer.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@
</script>
<% } %>

<% if (theme.giscus.enable) { %>
<% if (theme.giscus.enable && page.comments !== false) { %>
<script src="https://giscus.app/client.js"
data-repo='<%= theme.giscus.repo %>'
data-repo-id='<%= theme.giscus.repoId %>'
Expand Down
20 changes: 10 additions & 10 deletions layout/_partial/article.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -20,20 +20,20 @@
</div>
<footer class="article-footer">
<a data-url="<%- post.permalink %>" data-id="<%= post._id %>" data-title="<%= post.title %>" class="article-share-link"><%= __('share') %></a>
<% if (post.comments && theme.valine.enable && theme.valine.appId && theme.valine.appKey) { %>
<% if (post.comments !== false && theme.valine.enable && theme.valine.appId && theme.valine.appKey) { %>
<a href="<%- url_for(post.path) %>#comments" class="article-comment-link">
<span class="post-comments-count valine-comment-count" data-xid="<%- url_for(post.path, {relative: false}).endsWith("index.html") ?
url_for(post.path, {relative: false}).slice(0, -10) : url_for(post.path, {relative: false})%>" itemprop="commentCount"></span>
<%= __('comment') %>
</a>
<% } %>
<% if (post.comments && theme.waline.enable && theme.waline.serverURL) { %>
<% if (post.comments !== false && theme.waline.enable && theme.waline.serverURL) { %>
<a href="<%- url_for(post.path) %>#comments" class="article-comment-link">
<span class="post-comments-count waline-comment-count" data-path="<%- url_for(post.path, {relative: false}) %>" itemprop="commentCount"></span>
<%= __('comment') %>
</a>
<% } %>
<% if (post.comments && theme.twikoo.enable && theme.twikoo.envId) { %>
<% if (post.comments !== false && theme.twikoo.enable && theme.twikoo.envId) { %>
<a href="<%- url_for(post.path) %>#comments" class="article-comment-link">
<span class="post-comments-count twikoo-comment-count" data-path="<%- url_for(post.path, {relative: false}) %>" itemprop="commentCount"></span>
<%= __('comment') %>
Expand All @@ -53,15 +53,15 @@
});
</script>
<% } %>
<% if (theme.valine.enable && theme.valine.appId && theme.valine.appKey && theme.valine.visitor) { %>
<% if (post.comments !== false && theme.valine.enable && theme.valine.appId && theme.valine.appKey && theme.valine.visitor) { %>
<span id="<%- url_for(post.path, {relative: false}).endsWith("index.html") ?
url_for(post.path, {relative: false}).slice(0, -10) :
url_for(post.path, {relative: false})%>" class="leancloud_visitors article-visitor-link" data-flag-title="<%= post.title %>">
<span class="leancloud-visitors-count">0</span>
<em class="post-meta-item-text"><%= __('reading') %></em>
</span>
<% } %>
<% if (theme.waline.enable && theme.waline.serverURL && theme.waline.pageview) { %>
<% if (post.comments !== false && theme.waline.enable && theme.waline.serverURL && theme.waline.pageview) { %>
<span class="article-visitor-link">
<span class="waline-pageview-count" data-path="<%- url_for(post.path, {relative: false}).endsWith("index.html") ?
url_for(post.path, {relative: false}).slice(0, -10) :
Expand All @@ -76,18 +76,18 @@
<%- partial('post/nav') %>
<% } %>
</article>
<% if (!index && post.comments && theme.valine.enable && theme.valine.appId && theme.valine.appKey) { %>
<% if (!index && post.comments !== false && theme.valine.enable && theme.valine.appId && theme.valine.appKey) { %>
<section id="comments" class="vcomment"></section>
<% } %>
<% if (!index && post.comments && theme.waline.enable && theme.waline.serverURL) { %>
<% if (!index && post.comments !== false && theme.waline.enable && theme.waline.serverURL) { %>
<div id="comments" class="wcomment"></div>
<% } %>
<% if (!index && post.comments && theme.twikoo.enable && theme.twikoo.envId) { %>
<% if (!index && post.comments !== false && theme.twikoo.enable && theme.twikoo.envId) { %>
<div id="comments" class="tcomment"></div>
<% } %>
<% if (!index && post.comments && theme.gitalk.enable && theme.gitalk.clientID && theme.gitalk.clientSecret) { %>
<% if (!index && post.comments !== false && theme.gitalk.enable && theme.gitalk.clientID && theme.gitalk.clientSecret) { %>
<div id="comments" class="gtcomment"></div>
<% } %>
<% if (!index && post.comments && theme.giscus.enable) { %>
<% if (!index && post.comments !== false && theme.giscus.enable) { %>
<div id="comments" class="gscomment giscus"></div>
<% } %>
3 changes: 3 additions & 0 deletions source/css/_partial/comment.styl
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,6 @@

a
color: var(--color-link)

.gscomment
width: auto

0 comments on commit 7aa4d4d

Please sign in to comment.