mirror of https://github.com/luizdepra/hugo-coder.git

Michał Pawlik
23.20.2023 5cd634aa14645ffc59632d5e0eec3eec317dbc4f
Add support for microanalytics.io (#765)

### Prerequisites

Put an `x` into the box(es) that apply:

- [ ] This pull request fixes a bug.
- [x] This pull request adds a feature.
- [ ] This pull request introduces breaking change.

### Description

This PR introduces support for another analytics provider:
https://microanalytics.io/
This change provides new file in `layouts/partials/analytics` for the
introduced provider. Documentation has been respectively updated.


### Issues Resolved

None

### Checklist

Put an `x` into the box(es) that apply:

#### General

- [x] Describe what changes are being made
- [x] Explain why and how the changes were necessary and implemented
respectively
- [ ] Reference issue with `#<ISSUE_NO>` if applicable

#### Resources

- [ ] If you have changed any SCSS code, run `make release` to
regenerate all CSS files

#### Contributors

- [x] Add yourself to `CONTRIBUTORS.md` if you aren't on it already

Co-authored-by: Luiz F. A. de Prá <luizdepra@users.noreply.github.com>
4 files modified
1 files added
28 ■■■■■ changed files
CONTRIBUTORS.md 1 ●●●● patch | view | raw | blame | history
docs/configurations.md 8 ●●●●● patch | view | raw | blame | history
exampleSite/config.toml 5 ●●●●● patch | view | raw | blame | history
layouts/_default/baseof.html 6 ●●●● patch | view | raw | blame | history
layouts/partials/analytics/microanalyticsio.html 8 ●●●●● patch | view | raw | blame | history
CONTRIBUTORS.md
@@ -124,3 +124,4 @@
- [ShortArrow](https://github.com/ShortArrow)
- [Martin Hellspong](https://github.com/marhel)
- [Robert Tucker](https://github.com/robertwtucker)
- [Michał Pawlik](https://michalp.net)
docs/configurations.md
@@ -100,6 +100,14 @@
    connectionString = "connectionstring" # https://docs.microsoft.com/en-us/azure/azure-monitor/app/sdk-connection-string
```
#### microanalytics.io
```toml
[params.microAnalytics]
    id = "ABCDE"
    dnt = "false" # respect DNT tracker, "true" by default
```
### Commenting Systems
Comments are displayed within post pages, but can be disabled with `disableComments` front-matter.
exampleSite/config.toml
@@ -77,6 +77,11 @@
# [params.applicationInsights]
# connectionString = "connectionString"
# If you want to use microanalytics.io for analytics, add this section
# [params.microAnalytics]
# id = "ABCDE"
# dnt = "false" # respect DNT tracker, "true" by default
# If you want to implement a Content-Security-Policy, add this section
# [params.csp]
# childsrc = ["'self'"]
layouts/_default/baseof.html
@@ -87,7 +87,11 @@
  {{ end }}
  {{ if and .Site.Params.applicationInsights .Site.Params.applicationInsights.connectionString }}
    {{- partial "analytics/applicationinsights" . -}}
  {{- partial "analytics/applicationinsights" . -}}
  {{ end }}
  {{ if and .Site.Params.microAnalytics .Site.Params.microAnalytics.id }}
  {{- partial "analytics/microanalyticsio" . -}}
  {{ end }}
  {{- partial "body/extensions" . -}}
layouts/partials/analytics/microanalyticsio.html
New file
@@ -0,0 +1,8 @@
<script
    async
    defer
    data-host="https://microanalytics.io"
    data-dnt="{{ .Site.Params.microAnalytics.dnt | default "true" }}"
    src="https://microanalytics.io/js/script.js"
    id="{{ .Site.Params.microAnalytics.id }}">
</script>