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

github.com/curttimson/hugo-theme-massively.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCurtis Timson <curt@live.co.uk>2018-02-25 02:31:32 +0300
committerCurtis Timson <curt@live.co.uk>2018-02-25 02:31:32 +0300
commit4f3a6eaabdec5a035a3bbdadd8a26ff110267921 (patch)
treeca40ceb7409eb01e6b0e33c09d40af18f7b56666 /layouts
parent06277bf67c08dd5b5226db5a5f2135278461c57c (diff)
:sparkles: Add disqus support
Diffstat (limited to 'layouts')
-rw-r--r--layouts/_default/single.html4
-rw-r--r--layouts/partials/scripts/disqus.html19
-rw-r--r--layouts/partials/scripts/index.html3
3 files changed, 25 insertions, 1 deletions
diff --git a/layouts/_default/single.html b/layouts/_default/single.html
index 12c9d8c..353c6d4 100644
--- a/layouts/_default/single.html
+++ b/layouts/_default/single.html
@@ -23,6 +23,10 @@
<div class="image main"><img src="{{ .Site.BaseURL }}{{ .Params.image }}" alt="" /></div>
{{ end }}
{{ .Content }}
+
+ {{ if .Params.disqusid }}
+ <div id="disqus_thread"></div>
+ {{ end }}
</section>
</div>
diff --git a/layouts/partials/scripts/disqus.html b/layouts/partials/scripts/disqus.html
new file mode 100644
index 0000000..f698609
--- /dev/null
+++ b/layouts/partials/scripts/disqus.html
@@ -0,0 +1,19 @@
+{{ if and (.Site.Params.Settings.disqus) (.Params.disqusid) }}
+<script>
+ /**
+ * RECOMMENDED CONFIGURATION VARIABLES: EDIT AND UNCOMMENT THE SECTION BELOW TO INSERT DYNAMIC VALUES FROM YOUR PLATFORM OR CMS.
+ * LEARN WHY DEFINING THESE VARIABLES IS IMPORTANT: https://disqus.com/admin/universalcode/#configuration-variables*/
+
+ var disqus_config = function () {
+ this.page.url = {{ .Permalink }}; // Replace PAGE_URL with your page's canonical URL variable
+ this.page.identifier = {{ .Params.disqusid }}; // Replace PAGE_IDENTIFIER with your page's unique identifier variable
+ };
+
+ (function() { // DON'T EDIT BELOW THIS LINE
+ var d = document, s = d.createElement('script');
+ s.src = 'https://{{ .Site.Params.Settings.disqus }}.disqus.com/embed.js';
+ s.setAttribute('data-timestamp', +new Date());
+ (d.head || d.body).appendChild(s);
+ })();
+ </script>
+{{ end }} \ No newline at end of file
diff --git a/layouts/partials/scripts/index.html b/layouts/partials/scripts/index.html
index 491a583..f541a6a 100644
--- a/layouts/partials/scripts/index.html
+++ b/layouts/partials/scripts/index.html
@@ -6,4 +6,5 @@
<script src="{{ .Site.BaseURL }}assets/js/util.js"></script>
<script src="{{ .Site.BaseURL }}assets/js/main.js"></script>
-{{ partial "scripts/googleanalytics.html" . }}
+{{ partial "scripts/googleanalytics" . }}
+{{ partial "scripts/disqus" . }} \ No newline at end of file