Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/Fastbyte01/KeepIt.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGiuseppe Pignataro <rogepix@gmail.com>2019-03-15 12:15:32 +0300
committerGiuseppe Pignataro <rogepix@gmail.com>2019-03-15 12:15:32 +0300
commit9969bc696755c23fdeda468f8f6790d9c44251a8 (patch)
treea39fb818e077efdf65a68dd56a62fe17890936c5
parentcca4ddbcd68008d70770fc09f3ad8a27894520ec (diff)
Added gitalk comment system
-rw-r--r--exampleSite/config.toml7
-rw-r--r--layouts/_default/single.html4
-rw-r--r--layouts/partials/comments.html41
3 files changed, 48 insertions, 4 deletions
diff --git a/exampleSite/config.toml b/exampleSite/config.toml
index 595cde4..37c3712 100644
--- a/exampleSite/config.toml
+++ b/exampleSite/config.toml
@@ -130,4 +130,9 @@ copyright = "This work is licensed under a Creative Commons Attribution-NonComme
url = "cover.png"
width = 800
height = 600
-
+
+[params.gitalk]
+owner = ""
+repo = ""
+clientId = ""
+clientSecret = ""
diff --git a/layouts/_default/single.html b/layouts/_default/single.html
index 0dcadf8..a569fcf 100644
--- a/layouts/_default/single.html
+++ b/layouts/_default/single.html
@@ -103,9 +103,7 @@
<div class="post-comment">
{{ if ( .Params.showComments | default true ) }}
- {{ if ne .Site.DisqusShortname "" }}
- {{ template "_internal/disqus.html" . }}
- {{ end }}
+ {{ partial "comments.html" . }}
{{ end }}
</div>
</article>
diff --git a/layouts/partials/comments.html b/layouts/partials/comments.html
new file mode 100644
index 0000000..2bce448
--- /dev/null
+++ b/layouts/partials/comments.html
@@ -0,0 +1,41 @@
+{{ if and .IsPage (ne .Params.comment false) -}}
+ <!-- Disqus Comment System-->
+ {{- if .Site.DisqusShortname -}}
+ <div id="disqus_thread"></div>
+ <script type="text/javascript">
+ (function() {
+ // Don't ever inject Disqus on localhost--it creates unwanted
+ // discussions from 'localhost:1313' on your Disqus account...
+ if (window.location.hostname === 'localhost') return;
+
+ var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
+ var disqus_shortname = '{{ .Site.DisqusShortname }}';
+ dsq.src = '//' + disqus_shortname + '.disqus.com/embed.js';
+ (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
+ })();
+ </script>
+ <noscript>Please enable JavaScript to view the <a href="http://disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript>
+ {{- end -}}
+
+ <!-- gitalk Comment System-->
+ {{- if .Site.Params.gitalk.owner -}}
+ <div id="gitalk-container"></div>
+ <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/gitalk@1/dist/gitalk.css" crossorigin="anonymous">
+ <script src="https://cdn.jsdelivr.net/npm/gitalk@1/dist/gitalk.min.js" crossorigin="anonymous"></script>
+ <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 }} \ No newline at end of file