Browse Source

Add Google Analytics option

Fixes #3
master
digitalcraftsman 9 years ago
parent
commit
22c8662eb4
  1. 2
      exampleSite/config.toml
  2. 12
      layouts/partials/js.html

2
exampleSite/config.toml

@ -12,6 +12,8 @@ theme = "hugo-cactus-theme"
twitter = "Your Twitter account"
# Disable comments by leaving disqusShortname empty
disqusShortname = "spf13"
# Enter your tracking code to enable Google Analytics
googleAnalytics = ""
enableRSS = true
# The variables below are optionally too and can be used to

12
layouts/partials/js.html

@ -1,4 +1,14 @@
<script src="//ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="{{ .Site.BaseURL }}js/main.js"></script>
<script src="{{ .Site.BaseURL }}js/highlight.js"></script>
<script>hljs.initHighlightingOnLoad();</script>
<script>hljs.initHighlightingOnLoad();</script>
{{ with .Site.Params.googleAnalytics }}
{{ "<!-- Google Analytics -->" | safeHTML }}
<script>
var _gaq=[['_setAccount','{{ . }}'],['_trackPageview']];
(function(d,t){var g=d.createElement(t),s=d.getElementsByTagName(t)[0];
g.src=('https:'==location.protocol?'//ssl':'//www')+'.google-analytics.com/ga.js';
s.parentNode.insertBefore(g,s)}(document,'script'));
</script>
{{ end }}
Loading…
Cancel
Save