Skip to content

Commit

Permalink
feat: Add valine comment
Browse files Browse the repository at this point in the history
  • Loading branch information
liuyib committed Jul 15, 2019
1 parent 7667e19 commit 170fcb3
Show file tree
Hide file tree
Showing 5 changed files with 68 additions and 7 deletions.
35 changes: 32 additions & 3 deletions _config.yml
Expand Up @@ -341,7 +341,7 @@ reward:
# --------------------------------------------------------------- # ---------------------------------------------------------------


# Gitment # Gitment
# See: https://github.com/imsun/gitment # See: https://github.com/imsun/gitment/
gitment: gitment:
enable: false enable: false
# Github username. # Github username.
Expand All @@ -356,7 +356,7 @@ gitment:
lazy: true lazy: true


# Gittalk # Gittalk
# See: https://github.com/gitalk/gitalk # See: https://github.com/gitalk/gitalk/
gitalk: gitalk:
enable: false enable: false
# Github username. # Github username.
Expand All @@ -377,6 +377,33 @@ gitalk:
# Available values: en, zh-CN, es-ES, fr, ru, zh-TW # Available values: en, zh-CN, es-ES, fr, ru, zh-TW
language: language:


# Valine
# See: https://valine.js.org/quickstart.html
valine:
enable: false
# Your leancloud application appid.
appid:
# Your leancloud application appkey.
appkey:
# Mail notifier.
notify: true
# Verification code.
verify: true
# Comment box placeholder.
placeholder: Just go go
# Gravatar style.
avatar: mp
# Custom comment header.
meta: nick,mail,link
# Pagination size.
pageSize: 10
# Article reading statistics.
visitor: false
# Whether to record the commenter IP.
recordIP: false
# language, available values: en, zh-cn.
language:

# Livere # Livere
# See: https://www.livere.com/ # See: https://www.livere.com/
livere: livere:
Expand All @@ -394,8 +421,10 @@ disqus:
# Statistics and Analytics config # Statistics and Analytics config
# --------------------------------------------------------------- # ---------------------------------------------------------------


# Busuanzi statistics
# See: https://busuanzi.ibruce.info/
busuanzi: busuanzi:
enable: true enable: false
site: site:
# Only show by icon. # Only show by icon.
icon_only: false icon_only: false
Expand Down
2 changes: 2 additions & 0 deletions layout/_components/comments.pug
Expand Up @@ -15,3 +15,5 @@ else if theme.livere && theme.livere.enable
else if theme.disqus && theme.disqus.enable else if theme.disqus && theme.disqus.enable
div#comments.comments.main-content-layout div#comments.comments.main-content-layout
div#disqus_thread div#disqus_thread
else if theme.valine && theme.valine.enable
div#comments.comments.main-content-layout
2 changes: 2 additions & 0 deletions layout/_third-party/comments/index.pug
Expand Up @@ -7,3 +7,5 @@ if page.comments
include ./livere.pug include ./livere.pug
else if theme.disqus && theme.disqus.enable else if theme.disqus && theme.disqus.enable
include ./disqus.pug include ./disqus.pug
else if theme.valine && theme.valine.enable
include ./valine.pug
27 changes: 27 additions & 0 deletions layout/_third-party/comments/valine.pug
@@ -0,0 +1,27 @@
script(src='https://cdn1.lncld.net/static/js/3.0.4/av-min.js')
script(src='https://cdn.jsdelivr.net/npm/valine@latest/dist/Valine.min.js')

script.
window.onload = function() {
var GUEST_INFO = ['nick', 'mail', 'link'];
var guest_info = '!{ theme.valine.meta }';

guest_info = guest_info.split(',').filter(function(item) {
return GUEST_INFO.indexOf(item) > -1;
});

new Valine({
el: '#comments',
appId: '!{ theme.valine.appid }',
appKey: '!{ theme.valine.appkey }',
notify: !{ theme.valine.notify },
verify: !{ theme.valine.verify },
placeholder: '!{ theme.valine.placeholder }',
avatar: '!{ theme.valine.avatar }',
meta: guest_info,
pageSize: '!{ theme.valine.pageSize }' || 10,
visitor: !{ theme.valine.visitor },
recordIP: !{ theme.valine.recordIP },
lang: '!{ theme.valine.language }' || 'zh-cn'
});
};
9 changes: 5 additions & 4 deletions source/css/_components/comments.styl
@@ -1,14 +1,15 @@
.comments .comments
display: flex display: flex
margin: 1.5rem 0 0 margin: 1.5rem 0 0
flex-direction: column


a a
text-decoration: none !important text-decoration: none !important


// Gitment // Gitment
#gitment-container #gitment-container
width: 100% width: 100%

#gitment-button #gitment-button
margin: 0 auto margin: 0 auto
border-radius: 10px border-radius: 10px
Expand All @@ -23,15 +24,15 @@
background-color: $blue-light background-color: $blue-light


a.gitment-editor-avatar a.gitment-editor-avatar
clearAStyle() clearAStyle()


// Gitalk // Gitalk
#gitalk-container #gitalk-container
width: 100% width: 100%

& > :first-child & > :first-child
margin: 0 auto margin: 0 auto

// Livere // Livere
#lv-container #lv-container
width: 100% width: 100%
Expand Down

0 comments on commit 170fcb3

Please sign in to comment.