valine.swig 1.1 KB

1234567891011121314151617181920212223242526272829
  1. {%- set valine_uri = theme.vendors.valine or '//unpkg.com/valine/dist/Valine.min.js' %}
  2. <script>
  3. NexT.utils.loadComments(document.querySelector('#valine-comments'), () => {
  4. NexT.utils.getScript('{{ valine_uri }}', () => {
  5. var GUEST = ['nick', 'mail', 'link'];
  6. var guest = '{{ theme.valine.guest_info }}';
  7. guest = guest.split(',').filter(item => {
  8. return GUEST.includes(item);
  9. });
  10. new Valine({
  11. el : '#valine-comments',
  12. verify : {{ theme.valine.verify }},
  13. notify : {{ theme.valine.notify }},
  14. appId : '{{ theme.valine.appid }}',
  15. appKey : '{{ theme.valine.appkey }}',
  16. placeholder: {{ theme.valine.placeholder | json }},
  17. avatar : '{{ theme.valine.avatar }}',
  18. meta : guest,
  19. pageSize : '{{ theme.valine.pageSize }}' || 10,
  20. visitor : {{ theme.valine.visitor }},
  21. lang : '{{ theme.valine.language }}' || 'zh-cn',
  22. path : location.pathname,
  23. recordIP : {{ theme.valine.recordIP }},
  24. serverURLs : '{{ theme.valine.serverURLs }}'
  25. });
  26. }, window.Valine);
  27. });
  28. </script>