aboutsummaryrefslogtreecommitdiff
path: root/layouts/partials
diff options
context:
space:
mode:
authoralicewish <anywaywillgo@gmail.com>2017-12-20 21:33:05 +0800
committerolOwOlo <26087907+olOwOlo@users.noreply.github.com>2017-12-20 21:33:05 +0800
commit5ec874d64e1fe31278acde1b1444b26620a0fbc8 (patch)
treebda6321c4d3e9b94113ac829bfbe536abbe18762 /layouts/partials
parent1bb6eea8a84cbf67a7396abb63223f6a719aad60 (diff)
feat: add LiveRe and busuanzi (#17)
* LiveRe: commenting system * busuanzi: count web traffic
Diffstat (limited to 'layouts/partials')
-rw-r--r--layouts/partials/comments.html39
-rw-r--r--layouts/partials/footer.html20
-rw-r--r--layouts/partials/head.html5
3 files changed, 52 insertions, 12 deletions
diff --git a/layouts/partials/comments.html b/layouts/partials/comments.html
index 8728c17..afce2a3 100644
--- a/layouts/partials/comments.html
+++ b/layouts/partials/comments.html
@@ -4,24 +4,23 @@
<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;
+ // 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);
+ 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" target="_blank">comments powered by <span class="logo-disqus">Disqus</span></a>
{{- end }}
<!-- changyan -->
{{- if and .Site.Params.changyanAppid .Site.Params.changyanAppkey -}}
- <div id="SOHUCS"></div>
- <script type="text/javascript">
+ <div id="SOHUCS"></div>
+ <script type="text/javascript">
(function(){
if (window.location.hostname === 'localhost') return;
@@ -32,4 +31,24 @@
})();
</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 }} \ No newline at end of file
diff --git a/layouts/partials/footer.html b/layouts/partials/footer.html
index 7ce1aaf..50ddeb4 100644
--- a/layouts/partials/footer.html
+++ b/layouts/partials/footer.html
@@ -1,3 +1,4 @@
+{{ $lang := .Site.Data.even.default -}}
<div class="social-links">
{{- range $name, $path := .Site.Params.social }}
{{- if $path }}
@@ -10,14 +11,29 @@
<div class="copyright">
<span class="power-by">
- {{ (printf .Site.Data.even.default.footer.powered `<a class="hexo-link" href="https://gohugo.io">Hugo</a>`) | safeHTML }}
+ {{ (printf $lang.footer.powered `<a class="hexo-link" href="https://gohugo.io">Hugo</a>`) | safeHTML }}
</span>
<span class="division">|</span>
<span class="theme-info">
- {{ .Site.Data.even.default.footer.theme }} -
+ {{ $lang.footer.theme }} -
<a class="theme-link" href="https://github.com/olOwOlo/hugo-theme-even">Even</a>
</span>
+ {{ if .Site.Params.busuanzi.enable -}}
+ <div class="busuanzi-footer">
+ {{ $spinner := "img/spinner.svg" | relURL -}}
+ {{ if and .Site.Params.busuanzi.enable .Site.Params.busuanzi.sitePV -}}
+ {{ $valueSpan := printf `<span id="busuanzi_value_site_pv"><img src="%s" alt="spinner.svg"/></span>` $spinner -}}
+ <span id="busuanzi_container_site_pv"> {{ printf $lang.traffic.sitePV $valueSpan | safeHTML }} </span>
+ {{ if .Site.Params.busuanzi.siteUV }}<span class="division">|</span>{{ end }}
+ {{- end }}
+ {{ if and .Site.Params.busuanzi.enable .Site.Params.busuanzi.siteUV -}}
+ {{ $valueSpan := printf `<span id="busuanzi_value_site_uv"><img src="%s" alt="spinner.svg"/></span>` $spinner -}}
+ <span id="busuanzi_container_site_uv"> {{ printf $lang.traffic.siteUV $valueSpan | safeHTML }} </span>
+ {{- end }}
+ </div>
+ {{- end }}
+
<span class="copyright-year">
{{- $current := now.Format "2006" }}
&copy;
diff --git a/layouts/partials/head.html b/layouts/partials/head.html
index 086adee..46c771e 100644
--- a/layouts/partials/head.html
+++ b/layouts/partials/head.html
@@ -56,6 +56,11 @@
<script>eruda.init();</script>
{{- end }}
+<!-- busuanzi -->
+{{ if .Site.Params.busuanzi.enable -}}
+<script async src="//dn-lbstatics.qbox.me/busuanzi/2.3/busuanzi.pure.mini.js"></script>
+{{- end }}
+
<!-- Styles -->
<link href="{{ "dist/even.min.css?v=2.7.0" | relURL }}" rel="stylesheet">
{{ if .Site.Params.bootcdn -}}