aboutsummaryrefslogtreecommitdiff
path: root/layouts
diff options
context:
space:
mode:
authorTrack3 <pengliabc@live.cn>2018-12-11 13:41:01 +0800
committerTrack3 <pengliabc@live.cn>2018-12-11 13:41:01 +0800
commitcaf088cbfb4899e4d86fcb18373c4093f32c739b (patch)
tree198fd68a2c5b2b72877cd199a952fd7809ffd7eb /layouts
parent50fe5d104555a4b64e2e0aade41f2d510a88063f (diff)
downloadhermit-caf088cbfb4899e4d86fcb18373c4093f32c739b.tar.gz
Fix Disqus
* Use Hugo's built-in disqus template * Add some extra style * See #9
Diffstat (limited to 'layouts')
-rw-r--r--layouts/_default/single.html6
-rw-r--r--layouts/partials/disqus.html16
-rw-r--r--layouts/posts/single.html6
3 files changed, 8 insertions, 20 deletions
diff --git a/layouts/_default/single.html b/layouts/_default/single.html
index 7136bfb..8a4c168 100644
--- a/layouts/_default/single.html
+++ b/layouts/_default/single.html
@@ -8,8 +8,10 @@
<div class="content">
{{ .Content }}
</div>
- {{- with .Params.comments }}
- {{ with .Site.DisqusShortname }}{{ partialCached "disqus.html" . }}{{ end }}
+ {{- if and .Params.comments .Site.DisqusShortname }}
+ <div id="disqus" class="thin">
+ {{ template "_internal/disqus.html" . }}
+ </div>
{{- end }}
</main>
{{ end }}
diff --git a/layouts/partials/disqus.html b/layouts/partials/disqus.html
deleted file mode 100644
index b8a7c77..0000000
--- a/layouts/partials/disqus.html
+++ /dev/null
@@ -1,16 +0,0 @@
-<div id="disqus_thread"></div>
-<script type="text/javascript">
-(function() {
- // Don't ever inject Disqus on localhost--it creates unwanted
- // discussions from 'localhost:1313' on your Disqus account...
- if (window.location.hostname == "localhost")
- return;
-
- var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
- var disqus_shortname = '{{ .Site.DisqusShortname }}';
- dsq.src = '//' + disqus_shortname + '.disqus.com/embed.js';
- (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
-})();
-</script>
-<noscript>Please enable JavaScript to view the <a href="http://disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript>
-<a href="http://disqus.com/" class="dsq-brlink">comments powered by <span class="logo-disqus">Disqus</span></a> \ No newline at end of file
diff --git a/layouts/posts/single.html b/layouts/posts/single.html
index 62a875b..2c94eb0 100644
--- a/layouts/posts/single.html
+++ b/layouts/posts/single.html
@@ -44,8 +44,10 @@
</a>
{{- end }}
</div>
- {{- with .Site.DisqusShortname }}
- {{ partialCached "disqus.html" . }}
+ {{- if .Site.DisqusShortname }}
+ <div id="disqus" class="thin">
+ {{ template "_internal/disqus.html" . }}
+ </div>
{{- end }}
</main>
{{ end }}