diff options
author | Haohan Yang <37651510+haohanyang@users.noreply.github.com> | 2020-09-28 12:20:43 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-09-28 12:20:43 +0300 |
commit | c743559a4e8ec9ea53e2aa52f40ba87d426cc879 (patch) | |
tree | 00091f471d862c56dcd0890e23fdf4167c07c2a2 /layouts | |
parent | 950e6f6b0248c339670ecd881dd20f3441e1ca40 (diff) |
Add Disqus-integrationv2.1.0
Fixes #38
Diffstat (limited to 'layouts')
-rw-r--r-- | layouts/disqus.html | 22 | ||||
-rw-r--r-- | layouts/partials/footer.html | 5 |
2 files changed, 27 insertions, 0 deletions
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> © <time datetime="{{ now }}">{{ now.Format "2006" }}</time> {{ .Site.Author.name }}. {{ i18n "generator" | safeHTML }} </span> |