diff options
author | Chen Xianmin <xianmin12@gmail.com> | 2019-08-27 09:22:59 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-08-27 09:22:59 +0300 |
commit | 1fcd5c32fd7fe073d4fa444eff81256e67385fa3 (patch) | |
tree | 9526a111a3bd2d927855ffe5ea63197322200231 | |
parent | b8f412f8cf0ceb46ecc63da37811758ba776bc85 (diff) | |
parent | 3f6c38519d11c5a8bfd276d451ee593758f7ed25 (diff) |
Merge pull request #235 from Bennett-Yang/add-valine
Add valine ccomment system
-rw-r--r-- | exampleSite/full-config.toml | 12 | ||||
-rw-r--r-- | layouts/partials/comments.html | 31 |
2 files changed, 42 insertions, 1 deletions
diff --git a/exampleSite/full-config.toml b/exampleSite/full-config.toml index 2705ce4..ebdaf6e 100644 --- a/exampleSite/full-config.toml +++ b/exampleSite/full-config.toml @@ -147,6 +147,18 @@ defaultContentLanguage = "en" # Default language to use [params.livere] #LiveRe comment. see https://www.livere.com/ uid = "" + # Valine. + # You can get your appid and appkey from https://leancloud.cn + # more info please open https://valine.js.org + [params.valine] + enable = false + appId = '' + appKey = '' + notify = false # If you are using valine-admin(https://github.com/DesertsP/Valine-Admin) to notify users, do NOT enable this. + verify = false # Verification code + avatar = 'mm' + placeholder = '' + [params.search.google] # google custom search, see https://cse.google.com enable = false id = "002186711602136249422:q1gkomof_em" diff --git a/layouts/partials/comments.html b/layouts/partials/comments.html index 86fee0d..2b702e3 100644 --- a/layouts/partials/comments.html +++ b/layouts/partials/comments.html @@ -118,6 +118,35 @@ <a href="https://www.livere.com">comments powered by LiveRe.</a> </noscript> </div> - {{- end }} + {{- end }} + + <!-- valine --> + {{- if .Site.Params.valine.enable -}} + <div id="comments"></div> + <script src="//cdn1.lncld.net/static/js/3.0.4/av-min.js"></script> + <script src='//unpkg.com/valine/dist/Valine.min.js'></script> + <script> + if(window.location.hash){ + var checkExist = setInterval(function() { + if ($(window.location.hash).length) { + $('html, body').animate({scrollTop: $(window.location.hash).offset().top-90}, 700); + clearInterval(checkExist); + } + }, 10); + } + </script> + <script type="text/javascript"> + new Valine({ + el: '#comments' , + appId: '{{ .Site.Params.valine.appId }}', + appKey: '{{ .Site.Params.valine.appKey }}', + notify: {{ .Site.Params.valine.notify }}, + verify: {{ .Site.Params.valine.verify }}, + avatar:'{{ .Site.Params.valine.avatar }}', + placeholder: '{{ .Site.Params.valine.placeholder }}', + visitor: {{ false }} + }); + </script> + {{- end }} {{- end }} |