From 18196328d7185ab281a06706e2a72206b4e46859 Mon Sep 17 00:00:00 2001 From: Syahravi <syahravi.id@gmail.com> Date: Sat, 26 Feb 2022 15:13:01 +0700 Subject: [PATCH] add graphcomment --- exampleSite/config.toml | 5 ++++- exampleSiteMultilingual/config.toml | 5 ++++- layouts/partials/graphcomment.html | 32 +++++++++++++++++++++++++++++ 3 files changed, 40 insertions(+), 2 deletions(-) create mode 100644 layouts/partials/graphcomment.html diff --git a/exampleSite/config.toml b/exampleSite/config.toml index 5e3d15a..e1d58c4 100644 --- a/exampleSite/config.toml +++ b/exampleSite/config.toml @@ -21,6 +21,9 @@ readNextPosts = 2 copyCodeButton = true rssAsSocialIcon = true +# Graphcomment support +graphcommentId = "" + # utteranc.es support utterancesRepo = "" # mandatory utterancesTheme = "" # optional @@ -60,4 +63,4 @@ category = "categories" tag = "tags" [markup.goldmark.renderer] -unsafe = true \ No newline at end of file +unsafe = true diff --git a/exampleSiteMultilingual/config.toml b/exampleSiteMultilingual/config.toml index a18faea..e8cfc91 100644 --- a/exampleSiteMultilingual/config.toml +++ b/exampleSiteMultilingual/config.toml @@ -22,6 +22,9 @@ readNextPosts = 2 copyCodeButton = true rssAsSocialIcon = true +# Graphcomment support +graphcommentId = "" + # utteranc.es support utterancesRepo = "" # mandatory utterancesTheme = "" # optional @@ -83,4 +86,4 @@ category = "categories" tag = "tags" [markup.goldmark.renderer] -unsafe = true \ No newline at end of file +unsafe = true diff --git a/layouts/partials/graphcomment.html b/layouts/partials/graphcomment.html new file mode 100644 index 0000000..41960a7 --- /dev/null +++ b/layouts/partials/graphcomment.html @@ -0,0 +1,32 @@ +<div id="graphcomment"></div> +<script type="text/javascript"> + + /* - - - CONFIGURATION VARIABLES - - - */ + + var __semio__params = { + graphcommentId: "{{ .Site.Params.graphcommentId }}", // obviously you need to create your own ID on graphcomment.com + + behaviour: { + // HIGHLY RECOMMENDED + // uid: "...", // uniq identifer for the comments thread on your page (ex: your page id) + }, + + // configure your variables here + + } + + /* - - - DON'T EDIT BELOW THIS LINE - - - */ + + function __semio__onload() { + __semio__gc_graphlogin(__semio__params) + } + + + (function() { + var gc = document.createElement('script'); gc.type = 'text/javascript'; gc.async = true; + gc.onload = __semio__onload; gc.defer = true; gc.src = 'https://integration.graphcomment.com/gc_graphlogin.js?' + Date.now(); + (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(gc); + })(); + + +</script>