New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat:add valine comment system #74

Merged
merged 1 commit into from Oct 30, 2017

Conversation

2 participants
@xCss

xCss commented Oct 30, 2017

add valine comment system.

_config.yml

# use:disqus、valine
comment:
    use: 
    shortname:
    # https://valine.js.org
    valine: 
      appid:  # your leancloud appId
      appkey:  # your leancloud appKey
      notify: false #mail notify
      verify: false #verify code
      avatar: mm # gravatar style
      placeholder: Just go go # comment box placeholder
      guest_info: nick,mail,link # reviewer attributes

layout/_partials/comment.ejs

<% if(theme.comment.use === 'valine') { %>
  <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>
    var notify = '<%= theme.comment.valine.notify %>' == true ? true : false;
    var verify = '<%= theme.comment.valine.verify %>' == true ? true : false;
    var GUEST_INFO = ['nick','mail','link'];
    var guest_info = '<%= theme.comment.valine.guest_info %>'.split(',').filter(function(item){
      return GUEST_INFO.indexOf(item) > -1
    });
    guest_info = guest_info.length == 0 ? GUEST_INFO :guest_info;
    window.onload = function() {
        new Valine({
            el: '#comments',
            notify: notify,
            verify: verify,
            app_id: "<%= theme.comment.valine.appid %>",
            app_key: "<%= theme.comment.valine.appkey %>",
            avatar:"<%= theme.comment.valine.avatar %>",
            placeholder: "<%= theme.comment.valine.placeholder %>",
            guest_info:guest_info
        });
    }
  </script>
<% } %>

layout/post.ejs

-          <% if (theme.comment.use === 'disqus' || theme.comment.use === 'custom') { %>
+          <% if (theme.comment.use) { %>

@Halyul Halyul merged commit 8cdd487 into Halyul:dev Oct 30, 2017

1 check failed

continuous-integration/travis-ci/pr The Travis CI build failed
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment