mirror of https://github.com/lxndrblz/anatole.git

Alexander Bilz
01.40.2022 a9cb5630a21a320d3d3c1afe3781fd289129273e
feat: added umami analytics (#298)

1 files added
3 files modified
29 ■■■■■ changed files
README.md 13 ●●●●● patch | view | raw | blame | history
exampleSite/config/_default/params.toml 4 ●●●● patch | view | raw | blame | history
layouts/partials/analytics/umami.html 6 ●●●●● patch | view | raw | blame | history
layouts/partials/head.html 6 ●●●●● patch | view | raw | blame | history
README.md
@@ -28,6 +28,7 @@
- Comments powered by Disqus, Commento or Utteranc.es (optional)
- SimpleAnalytics (optional)
- Plausible Analytics (optional)
- Umami Analytics (optional)
- KaTex support (optional)
- Formspree Contact Form (optional)
- Twitter Cards support
@@ -409,7 +410,7 @@
### Plausible Analytics
To use Plausible Analytics, include the following section and change the domain to your site's domain. If you self-host Plausible, you can optionally specify the url of your own instance.
To use Plausible Analytics, include the following section and change the domain to your site's domain. If you self-host Plausible, you can optionally specify the URL of your own instance.
```toml
[params.plausibleAnalytics]
@@ -417,6 +418,16 @@
# serverURL = "https://analytics.example.com"
```
### Umami Analytics
To use Umami Analytics, include the following section and change the serverURL to your self-hosted Umami server URL. Additionally, you will need to provide your website ID.
```toml
[params.umami]
serverURL = "example.com"
id = "94db1cb1-74f4-4a40-ad6c-962362670409"
```
### Google Site Verification
To use Google Site Verification, add the following line to the `[params]`:
exampleSite/config/_default/params.toml
@@ -38,6 +38,10 @@
# domain = "example.com"
# serverURL = "https://analytics.example.com"
[umami]
# serverURL = "example.com"
# id = "94db1cb1-74f4-4a40-ad6c-962362670409"
## Math settings
[math]
enable = false  # options: true, false. Enable math support globally, default: false. You can always enable math on per page.
layouts/partials/analytics/umami.html
New file
@@ -0,0 +1,6 @@
<script
  async
  defer
  src="https://{{ .Site.Params.umami.serverURL }}/umami.js"
  data-website-id="{{ .Site.Params.umami.id }}"
></script>
layouts/partials/head.html
@@ -200,6 +200,12 @@
  {{ if and hugo.IsProduction .Site.Params.plausibleAnalytics .Site.Params.plausibleAnalytics.domain }}
    {{- partial "analytics/plausible" . -}}
  {{ end }}
  {{ if and hugo.IsProduction .Site.Params.umami.serverURL .Site.Params.umami.id }}
    {{- partial "analytics/umami" . -}}
  {{ end }}