File tree Expand file tree Collapse file tree 2 files changed +28
-21
lines changed
Expand file tree Collapse file tree 2 files changed +28
-21
lines changed Original file line number Diff line number Diff line change 88
99 # Waline server address url, you should set this to your own link
1010 serverURL : https://waline.vercel.app
11+
12+ # If false, disable the comment
13+ comment : true
1114
1215 # Waline library CDN url, you can set this to your preferred CDN
1316 # libUrl: https://unpkg.com/@waline/client@v3/dist/waline.umd.js
Original file line number Diff line number Diff line change @@ -33,12 +33,14 @@ hexo.extend.filter.register('theme_inject', (injects) => {
3333
3434 if ( ! config . enable || ! config . serverURL ) return ;
3535
36- injects . comment . raw (
37- 'waline' ,
38- '<div class="comments" id="waline"></div>' ,
39- { } ,
40- { cache : true } ,
41- ) ;
36+ if ( config . comment ) {
37+ injects . comment . raw (
38+ 'waline' ,
39+ '<div class="comments" id="waline"></div>' ,
40+ { } ,
41+ { cache : true } ,
42+ ) ;
43+ }
4244
4345 injects . bodyEnd . raw ( 'waline' , utils . getFileContent ( 'waline.njk' ) ) ;
4446
@@ -56,21 +58,23 @@ hexo.extend.filter.register('theme_inject', (injects) => {
5658
5759 if ( ! config . enable || ! config . serverURL ) return ;
5860
59- injects . postMeta . raw (
60- 'waline_comments' ,
61- `
62- {% if post.comments and (is_post() or config.waline.commentCount) %}
63- <span class="post-meta-item">
64- ${ iconText ( 'far fa-comment' , 'waline' ) }
65- <a title="waline" href="{{ url_for(post.path) }}#waline" itemprop="discussionUrl">
66- <span class="post-comments-count waline-comment-count" data-path="{{ url_for(post.path) }}" itemprop="commentCount"></span>
67- </a>
68- </span>
69- {% endif %}
70- ` ,
71- { } ,
72- { } ,
73- ) ;
61+ if ( config . commentCount ) {
62+ injects . postMeta . raw (
63+ 'waline_comments' ,
64+ `
65+ {% if post.comments and (is_post() or config.waline.commentCount) %}
66+ <span class="post-meta-item">
67+ ${ iconText ( 'far fa-comment' , 'waline' ) }
68+ <a title="waline" href="{{ url_for(post.path) }}#waline" itemprop="discussionUrl">
69+ <span class="post-comments-count waline-comment-count" data-path="{{ url_for(post.path) }}" itemprop="commentCount"></span>
70+ </a>
71+ </span>
72+ {% endif %}
73+ ` ,
74+ { } ,
75+ { } ,
76+ ) ;
77+ }
7478
7579 if ( config . pageview ) {
7680 // ensure to turn of valine visitor
You can’t perform that action at this time.
0 commit comments