diff options
author | WayJam So <imsuwj@gmail.com> | 2020-05-10 11:44:27 +0300 |
---|---|---|
committer | WayJam So <imsuwj@gmail.com> | 2020-05-10 11:45:36 +0300 |
commit | b8a76222ff4134864976a03c061407e9a599ef97 (patch) | |
tree | 8bca0347780abbb50ef52ed0342a6232a9a77c07 | |
parent | 9579d503bf75ba1fc5b08f0326236137b289c3c5 (diff) |
update: valine comment config
-rw-r--r-- | exampleSite/config.toml | 11 | ||||
-rw-r--r-- | layouts/partials/comments.html | 18 |
2 files changed, 16 insertions, 13 deletions
diff --git a/exampleSite/config.toml b/exampleSite/config.toml index 0558b7e..8461f20 100644 --- a/exampleSite/config.toml +++ b/exampleSite/config.toml @@ -35,15 +35,16 @@ postLicense = "" type = "none" [params.comment.valine] -appid = "appid" -appkey = "appkey" -notify = "notify" -verify = "verify" +appid = "your-appid" +appkey = "your-appkey" placeholder = "enjoy~" avatar = "mm" -meta = "nick,mail" pageSize = 10.0 visitor = false +recordIP = true +highlight = true +meta = "nick,mail" +requiredFields = "nick,mail" # Menu links along the sidebar navigation. [[menu.main]] diff --git a/layouts/partials/comments.html b/layouts/partials/comments.html index cb1b53a..e7cc87b 100644 --- a/layouts/partials/comments.html +++ b/layouts/partials/comments.html @@ -11,22 +11,24 @@ <div id="vcomments"></div> <script src="//unpkg.com/valine@latest/dist/Valine.min.js"></script> <script type="text/javascript"> - var GUEST = ['nick', 'mail', 'link']; - var meta = '{{- $comment.valine.meta }}'; - meta = meta.split(',').filter(function (item) { - return GUEST.indexOf(item) > -1; + const meta = '{{- $comment.valine.meta }}'.split(',').filter(function (item) { + return ['nick','mail','link'].indexOf(item) > -1; }); + const requiredFields = '{{- $comment.valine.requiredFields }}'.split(',').filter(function(item) { + return ['nick', 'mail'].indexOf(item) > -1; + }) new Valine({ el: '#vcomments', - verify: {{- $comment.valine.verify }}, - notify: {{- $comment.valine.notify }}, appId: '{{- $comment.valine.appid }}', appKey: '{{- $comment.valine.appkey }}', placeholder: '{{- $comment.valine.placeholder }}', avatar: '{{- $comment.valine.avatar }}', - meta: meta, pageSize: '{{- $comment.valine.pageSize }}' || 10, - visitor: {{- $comment.valine.visitor }} + visitor: {{- $comment.valine.visitor }}, + highlight: {{- $comment.valine.highlight }}, + recordIP: {{- $comment.valine.recordIP }}, + requiredFields: requiredFields || undefined, + meta: meta || undefined, }); </script> {{- else if eq $comment.type "disqus" }} |