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

Marc-Niclas Harm
30.16.2022 b84efff11943dc926d5e04892c215d5533dc4bc0
feat: Added Plausible Analytics (#296)

1 files added
3 files modified
19 ■■■■■ changed files
README.md 11 ●●●●● patch | view | raw | blame | history
exampleSite/config/_default/params.toml 4 ●●●● patch | view | raw | blame | history
layouts/partials/analytics/plausible.html 1 ●●●● patch | view | raw | blame | history
layouts/partials/head.html 3 ●●●●● patch | view | raw | blame | history
README.md
@@ -27,6 +27,7 @@
- Google Analytics (optional)
- Comments powered by Disqus, Commento or Utteranc.es (optional)
- SimpleAnalytics (optional)
- Plausible Analytics (optional)
- KaTex support (optional)
- Formspree Contact Form (optional)
- Twitter Cards support
@@ -406,6 +407,16 @@
# customurl = "https://analytics.example.com"
```
### 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.
```toml
[params.plausibleAnalytics]
domain = "example.com"
# serverURL = "https://analytics.example.com"
```
### Google Site Verification
To use Google Site Verification, add the following line to the `[params]`:
exampleSite/config/_default/params.toml
@@ -34,6 +34,10 @@
# enable = true
# customurl = "https://analytics.example.com"
[plausibleAnalytics]
# domain = "example.com"
# serverURL = "https://analytics.example.com"
## 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/plausible.html
New file
@@ -0,0 +1 @@
<script async defer data-domain="{{ .Site.Params.plausibleAnalytics.domain }}" src="{{ .Site.Params.plausibleAnalytics.serverURL | default "https://plausible.io" }}/js/plausible.js"></script>
layouts/partials/head.html
@@ -197,6 +197,9 @@
  {{- end -}}
  {{ if and hugo.IsProduction .Site.Params.plausibleAnalytics .Site.Params.plausibleAnalytics.domain }}
    {{- partial "analytics/plausible" . -}}
  {{ end }}
  <!-- Twitter Cards -->
  {{ template "_internal/twitter_cards.html" . }}