klugjo / hexo-theme-magnetic

Adaptation of http://pixelhint.com/magnetic-free-html5-responsive-photography-website-template/ for hexo
187 stars 66 forks source link

add valine comments system #14

Closed xCss closed 7 years ago

xCss commented 7 years ago

add valine comments system.

_config.yml:

# Valine comments https://valine.js.org
valine:
    appid:  # your leancloud appid
    appkey:  # your leancloud appkey
    notify: false # true/false:mail notify !!!Test,Caution. https://github.com/xCss/Valine/wiki/Valine-%E8%AF%84%E8%AE%BA%E7%B3%BB%E7%BB%9F%E4%B8%AD%E7%9A%84%E9%82%AE%E4%BB%B6%E6%8F%90%E9%86%92%E8%AE%BE%E7%BD%AE
    verify: false # true/false:verify code
    avatar: mm # avatar style https://github.com/xCss/Valine/wiki/avatar-setting-for-valine
    placeholder: Just go go # comment box placeholder

layout/_partial/comments.ejs:

<% if(page.comments && theme.comments && theme.comments.valine && theme.comments.valine.appid && theme.comments.valine.appkey ){ %>
    <hr />
    <h3><%- __('comment')%>:</h3>
    <div id="valine"></div>
    <script src="//cdn1.lncld.net/static/js/3.0.4/av-min.js"></script>
    <script src='//unpkg.com/valine@1.1.7/dist/Valine.min.js'></script>
    <script>
    new Valine({
        el: '#valine' ,
        notify:<%= theme.comments.valine.notify %>,
        verify:<%= theme.comments.valine.verify %>,
        app_id: '<%= theme.comments.valine.appid %>',
        app_key: '<%= theme.comments.valine.appkey %>',
        placeholder: '<%= theme.comments.valine.placeholder %>',
        path:window.location.pathname,
        avatar:'<%= theme.comments.valine.avatar %>' 
    });
    </script>
<% } %>

Preview

klugjo commented 7 years ago

谢谢

xCss commented 7 years ago

:smile: 客气~