Просмотр исходного кода

fix(disqus): missing comment count in listing previews

Fix #2171
George Cushen 4 лет назад
Родитель
Сommit
11814feeee

+ 0 - 4
wowchemy/layouts/partials/comments/disqus.html

@@ -19,8 +19,4 @@
 </script>
 <noscript>Please enable JavaScript to view the <a href="https://disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript>
 <a href="https://disqus.com" class="dsq-brlink">comments powered by <span class="logo-disqus">Disqus</span></a>
-
-{{ if (site.Params.comments.disqus.show_count | default true) }}
-  <script id="dsq-count-scr" src="https://{{site.Params.comments.disqus.shortname}}.disqus.com/count.js" async></script>
-{{end}}
 {{end}}

+ 7 - 0
wowchemy/layouts/partials/site_js.html

@@ -94,6 +94,13 @@
       {{ printf "<script src=\"%s\" integrity=\"%s\" crossorigin=\"anonymous\"></script>" (printf $js.plotly.url $js.plotly.version) $js.plotly.sri | safeHTML }}
     {{ end }}
 
+    {{/* Disqus Comment Count JS. */}}
+    {{/* Note: count can appear both in listing previews and on the content page itself. */}}
+    {{ $comments_provider := trim (site.Params.comments.provider | lower) " " }}
+    {{ if eq $comments_provider "disqus" | and (site.Params.comments.disqus.show_count | default true) }}
+      <script id="dsq-count-scr" src="https://{{site.Params.comments.disqus.shortname}}.disqus.com/count.js" async></script>
+    {{end}}
+
     {{ $js_bootstrap := resources.Get "js/_vendor/bootstrap.bundle.js" }}
     {{- if hugo.IsProduction -}}
       {{ $js_bootstrap = $js_bootstrap | minify | fingerprint "md5" }}