Skip to content

Commit 6e6fc74

Browse files
committedApr 30, 2020
Update options of Valine
1 parent 3dcd359 commit 6e6fc74

File tree

4 files changed

+12
-25
lines changed

4 files changed

+12
-25
lines changed
 

‎_config.yml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -605,13 +605,16 @@ changyan:
605605
# For more information: https://valine.js.org, https://github.com/xCss/Valine
606606
valine:
607607
enable: false
608-
appid: # Your leancloud application appid
609-
appkey: # Your leancloud application appkey
608+
appId: # Your leancloud application appid
609+
appKey: # Your leancloud application appkey
610610
notify: false # Mail notifier
611611
verify: false # Verification code
612612
placeholder: Just go go # Comment box placeholder
613613
avatar: mm # Gravatar style
614-
guest_info: nick,mail,link # Custom comment header
614+
meta: # Custom comment header
615+
- nick
616+
- mail
617+
- link
615618
pageSize: 10 # Pagination size
616619
language: # Language, available values: en, zh-cn
617620
visitor: false # Article reading statistic

‎layout/_macro/post.njk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@
9797
{%- endif %}
9898

9999
{# LeanCloud PageView #}
100-
{%- if theme.leancloud_visitors.enable or (theme.valine.enable and theme.valine.appid and theme.valine.appkey and theme.valine.visitor) %}
100+
{%- if theme.leancloud_visitors.enable or (theme.valine.enable and theme.valine.appId and theme.valine.appKey and theme.valine.visitor) %}
101101
<span id="{{ url_for(post.path) }}" class="post-meta-item leancloud_visitors" data-flag-title="{{ post.title }}" title="{{ __('post.views') }}">
102102
<span class="post-meta-item-icon">
103103
<i class="fa fa-eye"></i>

‎layout/_third-party/comments/valine.njk

Lines changed: 3 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -3,27 +3,11 @@
33
<script>
44
NexT.utils.loadComments(document.querySelector('#valine-comments'), () => {
55
NexT.utils.getScript('{{ valine_uri }}', () => {
6-
var GUEST = ['nick', 'mail', 'link'];
7-
var guest = '{{ theme.valine.guest_info }}';
8-
guest = guest.split(',').filter(item => {
9-
return GUEST.includes(item);
10-
});
11-
new Valine({
6+
new Valine(Object.assign({
127
el : '#valine-comments',
13-
verify : {{ theme.valine.verify }},
14-
notify : {{ theme.valine.notify }},
15-
appId : '{{ theme.valine.appid }}',
16-
appKey : '{{ theme.valine.appkey }}',
17-
placeholder: {{ theme.valine.placeholder | json }},
18-
avatar : '{{ theme.valine.avatar }}',
19-
meta : guest,
20-
pageSize : '{{ theme.valine.pageSize }}' || 10,
21-
visitor : {{ theme.valine.visitor }},
22-
lang : '{{ theme.valine.language }}' || 'zh-cn',
238
path : location.pathname,
24-
recordIP : {{ theme.valine.recordIP }},
25-
serverURLs : '{{ theme.valine.serverURLs }}'
26-
});
9+
}, {{ theme.valine | json }}
10+
));
2711
}, window.Valine);
2812
});
2913
</script>

‎scripts/filters/comment/valine.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ const { iconText } = require('./common');
88
// Add comment
99
hexo.extend.filter.register('theme_inject', injects => {
1010
let theme = hexo.theme.config;
11-
if (!theme.valine.enable || !theme.valine.appid || !theme.valine.appkey) return;
11+
if (!theme.valine.enable || !theme.valine.appId || !theme.valine.appKey) return;
1212

1313
injects.comment.raw('valine', '<div class="comments" id="valine-comments"></div>', {}, {cache: true});
1414

@@ -19,7 +19,7 @@ hexo.extend.filter.register('theme_inject', injects => {
1919
// Add post_meta
2020
hexo.extend.filter.register('theme_inject', injects => {
2121
let theme = hexo.theme.config;
22-
if (!theme.valine.enable || !theme.valine.appid || !theme.valine.appkey) return;
22+
if (!theme.valine.enable || !theme.valine.appId || !theme.valine.appKey) return;
2323

2424
injects.postMeta.raw('valine', `
2525
{% if post.comments and (is_post() or theme.valine.comment_count) %}

0 commit comments

Comments
 (0)
Please sign in to comment.