hugo-theme-even/layouts/partials/comments.html
alicewish 5ec874d64e feat: add LiveRe and busuanzi (#17)
* LiveRe: commenting system
* busuanzi: count web traffic
2017-12-20 21:33:05 +08:00

54 lines
No EOL
2.8 KiB
HTML

{{ if and .IsPage (ne .Params.comment false) }}
<!-- Disqus -->
{{- if .Site.DisqusShortname -}}
<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>
{{- end }}
<!-- changyan -->
{{- if and .Site.Params.changyanAppid .Site.Params.changyanAppkey -}}
<div id="SOHUCS"></div>
<script type="text/javascript">
(function(){
if (window.location.hostname === 'localhost') return;
var appid = '{{ .Site.Params.changyanAppid }}';
var conf = '{{ .Site.Params.changyanAppkey }}';
var width = window.innerWidth || document.documentElement.clientWidth;
if (width < 960) {window.document.write('<script id="changyan_mobile_js" charset="utf-8" type="text/javascript" src="https://changyan.sohu.com/upload/mobile/wap-js/changyan_mobile.js?client_id=' + appid + '&conf=' + conf + '"><\/script>'); } else { var loadJs=function(d,a){var c=document.getElementsByTagName("head")[0]||document.head||document.documentElement;var b=document.createElement("script");b.setAttribute("type","text/javascript");b.setAttribute("charset","UTF-8");b.setAttribute("src",d);if(typeof a==="function"){if(window.attachEvent){b.onreadystatechange=function(){var e=b.readyState;if(e==="loaded"||e==="complete"){b.onreadystatechange=null;a()}}}else{b.onload=a}}c.appendChild(b)};loadJs("https://changyan.sohu.com/upload/changyan.js",function(){window.changyan.api.config({appid:appid,conf:conf})}); }
})();
</script>
{{- end }}
<!-- LiveRe -->
{{- if .Site.Params.livereUID -}}
<div id="lv-container" data-id="city" data-uid="{{ .Site.Params.livereUID }}">
<script type="text/javascript">
(function(d, s) {
var j, e = d.getElementsByTagName(s)[0];
if (typeof LivereTower === 'function') { return; }
j = d.createElement(s);
j.src = 'https://cdn-city.livere.com/js/embed.dist.js';
j.async = true;
e.parentNode.insertBefore(j, e);
})(document, 'script');
</script>
<noscript>Please enable JavaScript to view the comments powered by <a href="https://livere.com/">LiveRe.</a></noscript>
</div>
{{- end }}
{{- end }}