Skip to content
This repository has been archived by the owner. It is now read-only.

feat:add valine comment system #74

Merged
merged 1 commit into from Oct 30, 2017
Merged

feat:add valine comment system #74

merged 1 commit into from Oct 30, 2017

Conversation

@xCss
Copy link

@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
1 check failed
continuous-integration/travis-ci/pr The Travis CI build failed
Details
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants