mirror of
https://github.com/next-theme/hexo-theme-next.git
synced 2026-01-18 18:33:42 +00:00
Update options of Valine
This commit is contained in:
parent
3dcd3594d1
commit
6e6fc74ae9
@ -605,13 +605,16 @@ changyan:
|
||||
# For more information: https://valine.js.org, https://github.com/xCss/Valine
|
||||
valine:
|
||||
enable: false
|
||||
appid: # Your leancloud application appid
|
||||
appkey: # Your leancloud application appkey
|
||||
appId: # Your leancloud application appid
|
||||
appKey: # Your leancloud application appkey
|
||||
notify: false # Mail notifier
|
||||
verify: false # Verification code
|
||||
placeholder: Just go go # Comment box placeholder
|
||||
avatar: mm # Gravatar style
|
||||
guest_info: nick,mail,link # Custom comment header
|
||||
meta: # Custom comment header
|
||||
- nick
|
||||
- mail
|
||||
- link
|
||||
pageSize: 10 # Pagination size
|
||||
language: # Language, available values: en, zh-cn
|
||||
visitor: false # Article reading statistic
|
||||
|
||||
@ -97,7 +97,7 @@
|
||||
{%- endif %}
|
||||
|
||||
{# LeanCloud PageView #}
|
||||
{%- if theme.leancloud_visitors.enable or (theme.valine.enable and theme.valine.appid and theme.valine.appkey and theme.valine.visitor) %}
|
||||
{%- if theme.leancloud_visitors.enable or (theme.valine.enable and theme.valine.appId and theme.valine.appKey and theme.valine.visitor) %}
|
||||
<span id="{{ url_for(post.path) }}" class="post-meta-item leancloud_visitors" data-flag-title="{{ post.title }}" title="{{ __('post.views') }}">
|
||||
<span class="post-meta-item-icon">
|
||||
<i class="fa fa-eye"></i>
|
||||
|
||||
22
layout/_third-party/comments/valine.njk
vendored
22
layout/_third-party/comments/valine.njk
vendored
@ -3,27 +3,11 @@
|
||||
<script>
|
||||
NexT.utils.loadComments(document.querySelector('#valine-comments'), () => {
|
||||
NexT.utils.getScript('{{ valine_uri }}', () => {
|
||||
var GUEST = ['nick', 'mail', 'link'];
|
||||
var guest = '{{ theme.valine.guest_info }}';
|
||||
guest = guest.split(',').filter(item => {
|
||||
return GUEST.includes(item);
|
||||
});
|
||||
new Valine({
|
||||
new Valine(Object.assign({
|
||||
el : '#valine-comments',
|
||||
verify : {{ theme.valine.verify }},
|
||||
notify : {{ theme.valine.notify }},
|
||||
appId : '{{ theme.valine.appid }}',
|
||||
appKey : '{{ theme.valine.appkey }}',
|
||||
placeholder: {{ theme.valine.placeholder | json }},
|
||||
avatar : '{{ theme.valine.avatar }}',
|
||||
meta : guest,
|
||||
pageSize : '{{ theme.valine.pageSize }}' || 10,
|
||||
visitor : {{ theme.valine.visitor }},
|
||||
lang : '{{ theme.valine.language }}' || 'zh-cn',
|
||||
path : location.pathname,
|
||||
recordIP : {{ theme.valine.recordIP }},
|
||||
serverURLs : '{{ theme.valine.serverURLs }}'
|
||||
});
|
||||
}, {{ theme.valine | json }}
|
||||
));
|
||||
}, window.Valine);
|
||||
});
|
||||
</script>
|
||||
|
||||
@ -8,7 +8,7 @@ const { iconText } = require('./common');
|
||||
// Add comment
|
||||
hexo.extend.filter.register('theme_inject', injects => {
|
||||
let theme = hexo.theme.config;
|
||||
if (!theme.valine.enable || !theme.valine.appid || !theme.valine.appkey) return;
|
||||
if (!theme.valine.enable || !theme.valine.appId || !theme.valine.appKey) return;
|
||||
|
||||
injects.comment.raw('valine', '<div class="comments" id="valine-comments"></div>', {}, {cache: true});
|
||||
|
||||
@ -19,7 +19,7 @@ hexo.extend.filter.register('theme_inject', injects => {
|
||||
// Add post_meta
|
||||
hexo.extend.filter.register('theme_inject', injects => {
|
||||
let theme = hexo.theme.config;
|
||||
if (!theme.valine.enable || !theme.valine.appid || !theme.valine.appkey) return;
|
||||
if (!theme.valine.enable || !theme.valine.appId || !theme.valine.appKey) return;
|
||||
|
||||
injects.postMeta.raw('valine', `
|
||||
{% if post.comments and (is_post() or theme.valine.comment_count) %}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user