Skip to content
This repository was archived by the owner on Jan 10, 2024. It is now read-only.

feat:add valine comment system#74

Merged
Halyul merged 1 commit intoHalyul:devfrom
xCss:dev
Oct 30, 2017
Merged

feat:add valine comment system#74
Halyul merged 1 commit intoHalyul:devfrom
xCss:dev

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
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants