mirror of
https://github.com/next-theme/hexo-theme-next.git
synced 2026-01-20 19:02:33 +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
|
# For more information: https://valine.js.org, https://github.com/xCss/Valine
|
||||||
valine:
|
valine:
|
||||||
enable: false
|
enable: false
|
||||||
appid: # Your leancloud application appid
|
appId: # Your leancloud application appid
|
||||||
appkey: # Your leancloud application appkey
|
appKey: # Your leancloud application appkey
|
||||||
notify: false # Mail notifier
|
notify: false # Mail notifier
|
||||||
verify: false # Verification code
|
verify: false # Verification code
|
||||||
placeholder: Just go go # Comment box placeholder
|
placeholder: Just go go # Comment box placeholder
|
||||||
avatar: mm # Gravatar style
|
avatar: mm # Gravatar style
|
||||||
guest_info: nick,mail,link # Custom comment header
|
meta: # Custom comment header
|
||||||
|
- nick
|
||||||
|
- mail
|
||||||
|
- link
|
||||||
pageSize: 10 # Pagination size
|
pageSize: 10 # Pagination size
|
||||||
language: # Language, available values: en, zh-cn
|
language: # Language, available values: en, zh-cn
|
||||||
visitor: false # Article reading statistic
|
visitor: false # Article reading statistic
|
||||||
|
|||||||
@ -97,7 +97,7 @@
|
|||||||
{%- endif %}
|
{%- endif %}
|
||||||
|
|
||||||
{# LeanCloud PageView #}
|
{# 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 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">
|
<span class="post-meta-item-icon">
|
||||||
<i class="fa fa-eye"></i>
|
<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>
|
<script>
|
||||||
NexT.utils.loadComments(document.querySelector('#valine-comments'), () => {
|
NexT.utils.loadComments(document.querySelector('#valine-comments'), () => {
|
||||||
NexT.utils.getScript('{{ valine_uri }}', () => {
|
NexT.utils.getScript('{{ valine_uri }}', () => {
|
||||||
var GUEST = ['nick', 'mail', 'link'];
|
new Valine(Object.assign({
|
||||||
var guest = '{{ theme.valine.guest_info }}';
|
|
||||||
guest = guest.split(',').filter(item => {
|
|
||||||
return GUEST.includes(item);
|
|
||||||
});
|
|
||||||
new Valine({
|
|
||||||
el : '#valine-comments',
|
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,
|
path : location.pathname,
|
||||||
recordIP : {{ theme.valine.recordIP }},
|
}, {{ theme.valine | json }}
|
||||||
serverURLs : '{{ theme.valine.serverURLs }}'
|
));
|
||||||
});
|
|
||||||
}, window.Valine);
|
}, window.Valine);
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@ -8,7 +8,7 @@ const { iconText } = require('./common');
|
|||||||
// Add comment
|
// Add comment
|
||||||
hexo.extend.filter.register('theme_inject', injects => {
|
hexo.extend.filter.register('theme_inject', injects => {
|
||||||
let theme = hexo.theme.config;
|
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});
|
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
|
// Add post_meta
|
||||||
hexo.extend.filter.register('theme_inject', injects => {
|
hexo.extend.filter.register('theme_inject', injects => {
|
||||||
let theme = hexo.theme.config;
|
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', `
|
injects.postMeta.raw('valine', `
|
||||||
{% if post.comments and (is_post() or theme.valine.comment_count) %}
|
{% if post.comments and (is_post() or theme.valine.comment_count) %}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user