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

github.com/htr3n/hyde-hyde.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNaNkeen <ck210400@protonmail.ch>2019-05-29 07:11:59 +0300
committerNaNkeen <ck210400@protonmail.ch>2019-05-29 07:11:59 +0300
commitb7be3ba6726eab551c856aaf7589f7b81a4021c7 (patch)
tree7372a6b13dd446cd20ed9169832be824c08d80ea /layouts
parent3551425f3f3f8044ff541113075537583f485c8c (diff)
Implemented Commento embedding
Diffstat (limited to 'layouts')
-rw-r--r--layouts/partials/page-single/comment/commento.html25
-rw-r--r--layouts/partials/page-single/post-comment.html2
2 files changed, 27 insertions, 0 deletions
diff --git a/layouts/partials/page-single/comment/commento.html b/layouts/partials/page-single/comment/commento.html
new file mode 100644
index 0000000..3861012
--- /dev/null
+++ b/layouts/partials/page-single/comment/commento.html
@@ -0,0 +1,25 @@
+<div id="commento"></div>
+<script type="text/javascript">
+ /*
+ Check and don't inject Commento on localhost/127.0.0.1, however, it does not
+ work for customised local domains, e.g. example.test, example.dev
+ */
+ (function () {
+ if (location.hostname === "localhost" ||
+ location.hostname === "127.0.0.1" ||
+ location.hostname === "") {
+ return;
+ }
+ var cmt = document.createElement('script');
+ cmt.type = 'text/javascript';
+ cmt.async = true;
+ var commento_host = '{{ with .Site.Params.CommentoHost }}{{ . }}{{else}}https://cdn.commento.io{{ end }}';
+ cmt.src = commento_host + '/js/commento.js';
+ (document.getElementsByTagName('head')[0] ||
+ document.getElementsByTagName('body')[0]).appendChild(cmt);
+ })();
+</script>
+
+<noscript>
+ Please enable JavaScript to view the comments powered by Commento.
+</noscript>
diff --git a/layouts/partials/page-single/post-comment.html b/layouts/partials/page-single/post-comment.html
index a9d2ab7..668a0e1 100644
--- a/layouts/partials/page-single/post-comment.html
+++ b/layouts/partials/page-single/post-comment.html
@@ -5,5 +5,7 @@
{{ partial "page-single/comment/graphcomment.html" . }}
{{ else if .Site.Params.UtterancesRepo }}
{{ partial "page-single/comment/utterances.html" . }}
+ {{ else if .Site.Params.Commento }}
+ {{ partial "page-single/comment/commento.html" . }}
{{ end }}
{{ end }}