Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/leonardofaria/bento.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLeonardo Faria <leonardofaria@gmail.com>2020-08-03 23:25:36 +0300
committerLeonardo Faria <leonardofaria@gmail.com>2020-08-03 23:25:36 +0300
commitb16a5e74212b5f0c11a4503a88c0360fd72212a9 (patch)
treee6b438038e4f1c626fa7e6343473dd5cb6c9c580
parent21152d6f51e58a1451effbf602990da5a0057f62 (diff)
Add Fathom Analytics support
-rw-r--r--README.md2
-rw-r--r--exampleSite/config.toml6
-rw-r--r--layouts/partials/fathom.html13
-rw-r--r--layouts/partials/footer.html4
4 files changed, 24 insertions, 1 deletions
diff --git a/README.md b/README.md
index d222496..cf0dd09 100644
--- a/README.md
+++ b/README.md
@@ -12,7 +12,7 @@ A minimalist theme for Hugo, built with Tailwind CSS.
- Responsive
- Super-fast - [100% in Lighthouse tests](https://lighthouse-dot-webdotdevsite.appspot.com//lh/html?url=https%3A%2F%2Fbento-hugo-theme.netlify.app%2F)
- Tailwind CSS with PostCSS: super tiny CSS file
-- Google Analytics and Disqus integration
+- Google Analytics, Fathom Analytics and Disqus integration
- Syntax Highlighting with GitHub theme
- Full content RSS
- Turbolinks: no page refresh
diff --git a/exampleSite/config.toml b/exampleSite/config.toml
index 5e321f9..790e269 100644
--- a/exampleSite/config.toml
+++ b/exampleSite/config.toml
@@ -51,6 +51,12 @@ disqusShortname = "bento-hugo-theme"
# Bio is shown in the end of posts
authorBio = "Bento is a doggo who likes to code. Follow him on <a href='#'>Twitter</a>"
+# If you want to use fathom(https://usefathom.com) for analytics, add this section
+[params.fathomAnalytics]
+ siteID = "XXXXX"
+ # Default value is cdn.usefathom.com, overwrite this if you are self-hosting
+ serverURL = "analytics.example.com"
+
# Items in the top menu
[menu]
[[menu.main]]
diff --git a/layouts/partials/fathom.html b/layouts/partials/fathom.html
new file mode 100644
index 0000000..a1a29e9
--- /dev/null
+++ b/layouts/partials/fathom.html
@@ -0,0 +1,13 @@
+<script>
+ (function(f, a, t, h, o, m){
+ a[h]=a[h]||function(){
+ (a[h].q=a[h].q||[]).push(arguments)
+ };
+ o=f.createElement('script'),
+ m=f.getElementsByTagName('script')[0];
+ o.async=1; o.src=t; o.id='fathom-script';
+ m.parentNode.insertBefore(o,m)
+ })(document, window, '//{{ .Site.Params.fathomAnalytics.serverURL | default "cdn.usefathom.com" }}/tracker.js', 'fathom');
+ fathom('set', 'siteId', '{{ .Site.Params.fathomAnalytics.siteID }}');
+ fathom('trackPageview');
+</script>
diff --git a/layouts/partials/footer.html b/layouts/partials/footer.html
index 0a3417b..54d6c8f 100644
--- a/layouts/partials/footer.html
+++ b/layouts/partials/footer.html
@@ -72,3 +72,7 @@
</script>
{{end}}
{{ template "_internal/google_analytics.html" . }}
+
+{{ if and .Site.Params.fathomAnalytics .Site.Params.fathomAnalytics.siteID }}
+ {{- partial "fathom" . -}}
+{{ end }} \ No newline at end of file