Skip to content

Commit

Permalink
feat: add gitalk (#51)
Browse files Browse the repository at this point in the history
  • Loading branch information
zhaozhiyuan1989 authored and olOwOlo committed Apr 5, 2018
1 parent d7c6059 commit 5f8b79f
Show file tree
Hide file tree
Showing 4 changed files with 61 additions and 1 deletion.
8 changes: 8 additions & 0 deletions exampleSite/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -94,13 +94,21 @@ copyright = "" # default: author.name ↓ # 默认为下面配
fancyboxCss = '<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fancyapps/fancybox@3.1.20/dist/jquery.fancybox.min.css" integrity="sha256-7TyXnr2YU040zfSP+rEcz29ggW4j56/ujTPwjMzyqFY=" crossorigin="anonymous">'
gitmentJS = '<script src="https://cdn.jsdelivr.net/npm/gitment@0.0.3/dist/gitment.browser.min.js" crossorigin="anonymous"></script>'
gitmentCSS = '<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/gitment@0.0.3/style/default.min.css" crossorigin="anonymous">'
gitalkJS = '<script src="https://cdn.jsdelivr.net/npm/gitalk@1.2.2/dist/gitalk.min.js" integrity="sha256-DcjhdbufsHMHflFjZtKNFnPKOAL2ybOxGcPOR4MtnJg=" crossorigin="anonymous"></script>'
gitalkCSS = '<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/gitalk@1.2.2/dist/gitalk.css" integrity="sha256-rJVe5uyYRXdLM+Kkoj7JtN+9qI0bZTxkYTaNWODpg7U=" crossorigin="anonymous">'

[params.gitment] # Gitment is a comment system based on GitHub issues. see https://github.com/imsun/gitment
owner = "" # Your GitHub ID
repo = "" # The repo to store comments
clientId = "" # Your client ID
clientSecret = "" # Your client secret

[params.gitalk] # Gitalk is a comment system based on GitHub issues. see https://github.com/gitalk/gitalk
owner = "" # Your GitHub ID
repo = "" # The repo to store comments
clientId = "" # Your client ID
clientSecret = "" # Your client secret

[params.flowchartDiagrams]# see https://blog.olowolo.com/example-site/post/js-flowchart-diagrams/
enable = false
options = ""
Expand Down
28 changes: 27 additions & 1 deletion layouts/partials/comments.html
Original file line number Diff line number Diff line change
Expand Up @@ -80,4 +80,30 @@
<noscript>Please enable JavaScript to view the <a href="https://github.com/imsun/gitment">comments powered by gitment.</a></noscript>
{{- end }}

{{- end }}
<!-- gitalk -->
{{- if .Site.Params.gitalk.owner -}}
<div id="gitalk-container"></div>
{{ if .Site.Params.publicCDN.enable -}}
{{ .Site.Params.publicCDN.gitalkCSS | safeHTML }}
{{ .Site.Params.publicCDN.gitalkJS | safeHTML }}
{{- else -}}
<link rel="stylesheet" href="{{ "lib/gitalk/gitalk-1.2.2.min.css" | relURL }}">
<script src="{{ "lib/gitalk/gitalk-1.2.2.min.js" | relURL }}"></script>
{{- end }}
<script type="text/javascript">
var gitalk = new Gitalk({
id: '{{ .Date }}',
title: '{{ .Title }}',
clientID: '{{ .Site.Params.gitalk.clientId }}',
clientSecret: '{{ .Site.Params.gitalk.clientSecret }}',
repo: '{{ .Site.Params.gitalk.repo }}',
owner: '{{ .Site.Params.gitalk.owner }}',
admin: ['{{ .Site.Params.gitalk.owner }}'],
body: decodeURI(location.href)
});
gitalk.render('gitalk-container');
</script>
<noscript>Please enable JavaScript to view the <a href="https://github.com/gitalk/gitalk">comments powered by gitalk.</a></noscript>
{{- end }}

{{- end }}
Loading

0 comments on commit 5f8b79f

Please sign in to comment.