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

github.com/EmielH/tale-hugo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHaohan Yang <37651510+haohanyang@users.noreply.github.com>2020-09-28 12:20:43 +0300
committerGitHub <noreply@github.com>2020-09-28 12:20:43 +0300
commitc743559a4e8ec9ea53e2aa52f40ba87d426cc879 (patch)
tree00091f471d862c56dcd0890e23fdf4167c07c2a2
parent950e6f6b0248c339670ecd881dd20f3441e1ca40 (diff)
Add Disqus-integrationv2.1.0
Fixes #38
-rw-r--r--README.md12
-rw-r--r--assets/scss/tale.scss1
-rw-r--r--assets/scss/tale/_disqus.scss3
-rw-r--r--layouts/disqus.html22
-rw-r--r--layouts/partials/footer.html5
5 files changed, 43 insertions, 0 deletions
diff --git a/README.md b/README.md
index 12002d2..cc0a97f 100644
--- a/README.md
+++ b/README.md
@@ -102,6 +102,18 @@ Feel free to submit pull requests for other translations of Tale's texts.
[Hugo documentation for multilingual sites](//gohugo.io/content-management/multilingual/)
+### Disqus
+Tale supports Disqus integration, a comment system that empowers dynamic features to static websites. To install it, just add the key `disqusShortname` in your `config.toml`
+``` toml
+disqusShortname = "disqus-example"
+```
+Add the parameter `comments` in the front-matter of the pages where you want to allow comments
+```
+---
+comments: true
+---
+```
+
### Custom summaries
Tale allows for writing the summary of your posts manually by setting the `summary` variable in the page frontmatter. If this variable is not set, the summary that Hugo automatically generates will be used.
diff --git a/assets/scss/tale.scss b/assets/scss/tale.scss
index 3cdfa99..9d1c12f 100644
--- a/assets/scss/tale.scss
+++ b/assets/scss/tale.scss
@@ -6,3 +6,4 @@
@import 'tale/layout';
@import 'tale/pagination';
@import 'tale/catalogue';
+@import 'tale/disqus';
diff --git a/assets/scss/tale/_disqus.scss b/assets/scss/tale/_disqus.scss
new file mode 100644
index 0000000..7474acf
--- /dev/null
+++ b/assets/scss/tale/_disqus.scss
@@ -0,0 +1,3 @@
+.article-discussion {
+ margin: 0;
+}
diff --git a/layouts/disqus.html b/layouts/disqus.html
new file mode 100644
index 0000000..376c36e
--- /dev/null
+++ b/layouts/disqus.html
@@ -0,0 +1,22 @@
+<div id="disqus_thread"></div>
+<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 = PAGE_URL; // Replace PAGE_URL with your page's canonical URL variable
+this.page.identifier = PAGE_IDENTIFIER; // Replace PAGE_IDENTIFIER with your page's unique identifier variable
+};
+*/
+(function() { // DON'T EDIT BELOW THIS LINE
+var d = document, s = d.createElement('script');
+var disqus_shortname = '{{ .Site.DisqusShortname }}';
+s.src = 'https://' + disqus_shortname + '.disqus.com/embed.js';
+s.setAttribute('data-timestamp', +new Date());
+(d.head || d.body).appendChild(s);
+})();
+</script>
+<noscript>Please enable JavaScript to view the <a href="https://disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript>
+
diff --git a/layouts/partials/footer.html b/layouts/partials/footer.html
index 3fdfa4f..e84a617 100644
--- a/layouts/partials/footer.html
+++ b/layouts/partials/footer.html
@@ -1,4 +1,9 @@
<footer>
+ {{ if and .Params.comments (gt (len .Site.DisqusShortname) 0) }}
+ <figure class="article-discussion">
+ {{ template "_internal/disqus.html" . }}
+ </figure>
+ {{ end }}
<span>
&copy; <time datetime="{{ now }}">{{ now.Format "2006" }}</time> {{ .Site.Author.name }}. {{ i18n "generator" | safeHTML }}
</span>