Skip to content

Commit

Permalink
✨ Feature(comment): add vssue comment system (#302)
Browse files Browse the repository at this point in the history
  • Loading branch information
LocTran committed Sep 30, 2020
1 parent de6c214 commit e49a2b2
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 1 deletion.
12 changes: 12 additions & 0 deletions _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,18 @@ disqus:
# placeholder: Just go go # valine comment input placeholder(like: Please leave your footprints )
# guest_info: nick,mail,link #valine comment header inf

# vssue:
# enable: false # Set to true to enable
# platform: github-v4
# owner:
# repo:
# clientId:
# clientSecret: # only required for some of the platforms
# autoCreateIssue: false # Auto create issue on platform (github/...)
# baseURL: "" # For self-hosted gitlab/bitbucket only, see here: https://vssue.js.org/options/#baseurl
# perPage: 10 # How much comment/page
# labels: 'Vssue'

# Footer Settings
# ---------------
since: 2013
Expand Down
4 changes: 3 additions & 1 deletion layout/includes/comments/index.pug
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,6 @@ else if theme.gitment && theme.gitment.enable
else if theme.gitalk && theme.gitalk.enable
include ./gitalk.pug
else if theme.valine && theme.valine.enable
include ./valine.pug
include ./valine.pug
else if theme.vssue && theme.vssue.enable
include ./vssue.pug
40 changes: 40 additions & 0 deletions layout/includes/comments/vssue.pug
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
if theme.vssue && theme.vssue.enable
#vssue-container
link(rel="stylesheet" href="https://cdn.jsdelivr.net/npm/vssue@1.4.6/dist/vssue.css")
script(src="https://cdn.jsdelivr.net/npm/vue@2.6.12/dist/vue.min.js")
- var platform = theme.vssue.platform || 'github'
script(src="https://cdn.jsdelivr.net/npm/vssue@1.4.6/dist/vssue." + platform + ".min.js")
//- Used for scripts
- var perPage = theme.vssue.perPage || 10
- var autoCreateIssue = theme.vssue.autoCreateIssue || false
if theme.vssue.baseURL !== ""
- var baseURL = theme.vssue.baseURL
else if ['github-v4', 'github'].includes(theme.vssue.platform)
- var baseURL = 'https://github.com'
else if theme.vssue.platform === 'gitlab'
- var baseURL = "https://gitlab.com"
else if theme.vssue.platform === 'gitee'
- var baseURL = "https://gitee.com"
else if theme.vssue.platform === 'gitea'
- var baseURL = "https://gitea.com"
else if theme.vssue.platform === 'bitbucket'
- var baseURL = "https://bitbucket.org"

script.
var vssue = new Vue({
el: '#vssue',

data: {
options: {
owner: '!{theme.vssue.owner}',
repo: '!{theme.vssue.repo}',
clientId:'!{theme.vssue.clientId}',
clientSecret: '!{theme.vssue.clientSecret}',
autoCreateIssue: !{autoCreateIssue},
baseURL: '!{baseURL}',
perPage: !{perPage},
labels: ['!{theme.vssue.labels}'],
},
},
})
vssue.render('vssue-container')

0 comments on commit e49a2b2

Please sign in to comment.