Fix Disqus

* Use Hugo's built-in disqus template
* Add some extra style
* See #9
This commit is contained in:
Track3 2018-12-11 13:41:01 +08:00
parent 50fe5d1045
commit caf088cbfb
6 changed files with 21 additions and 22 deletions

View file

@ -562,6 +562,7 @@ a.footnote-return {
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
margin-top: 1.5em; margin-top: 1.5em;
margin-bottom: 2.5em;
font-size: 1.2em; font-size: 1.2em;
a { a {
@ -579,6 +580,16 @@ a.footnote-return {
} }
} }
// Disqus
#disqus {
margin-top: 2.5em;
}
.dsq-brlink {
display: block;
text-align: center;
}
@media (min-width: 800px) { @media (min-width: 800px) {
.site-main { .site-main {
margin-top: 3em; margin-top: 3em;

View file

@ -8,8 +8,10 @@
<div class="content"> <div class="content">
{{ .Content }} {{ .Content }}
</div> </div>
{{- with .Params.comments }} {{- if and .Params.comments .Site.DisqusShortname }}
{{ with .Site.DisqusShortname }}{{ partialCached "disqus.html" . }}{{ end }} <div id="disqus" class="thin">
{{ template "_internal/disqus.html" . }}
</div>
{{- end }} {{- end }}
</main> </main>
{{ end }} {{ end }}

View file

@ -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>

View file

@ -44,8 +44,10 @@
</a> </a>
{{- end }} {{- end }}
</div> </div>
{{- with .Site.DisqusShortname }} {{- if .Site.DisqusShortname }}
{{ partialCached "disqus.html" . }} <div id="disqus" class="thin">
{{ template "_internal/disqus.html" . }}
</div>
{{- end }} {{- end }}
</main> </main>
{{ end }} {{ end }}

File diff suppressed because one or more lines are too long

View file

@ -1 +1 @@
{"Target":"css/style.min.bde2f5cd3b77a52d8db26f638dfed4b52085d3ea252fdf5746658b9883382220.css","MediaType":"text/css","Data":{"Integrity":"sha256-veL1zTt3pS2Nsm9jjf7UtSCF0+olL99XRmWLmIM4IiA="}} {"Target":"css/style.min.ec583408c122bca52321e03f9c58d80a134f8a85e464b32adcf049fd64bc5bcb.css","MediaType":"text/css","Data":{"Integrity":"sha256-7Fg0CMEivKUjIeA/nFjYChNPioXkZLMq3PBJ/WS8W8s="}}