Merge pull request 'Pull Request for Umami-Integration, Part I' (#15) from feat/rework-umami-integration into main

Reviewed-on: stiebke/hugo-internet-weblog#15
This commit is contained in:
Stephan Hadan 2025-01-29 08:46:56 +01:00
commit 21e652e38a
3 changed files with 11 additions and 2 deletions

View file

@ -166,6 +166,10 @@ If you want to enable a dark appearance, there is limited support for that. Curr
| `[params]` - `RSSMicropostTitles` | `true` or `false` | No. If false, Microposts RSS feeds will not have the title in included posts. If not present or true, nothing happens. |
| `[params]` - `YearlyMicroposts` | `true` or `false` | No. If true, Microposts will have a page with a yearly grouping just like the posts. If not present or false, the default of not having a micropost yearly grouping is applied. |
| `[params]` - `SummarizeMicroposts` | `true` or `false` | No. If true, Microposts will be summarized in the main list just like posts with a continue reading link. If not present or false, the default of not summarizing microposts is applied. |
| `[params]`- `umamienabled` | `true` or `false` | No. If true and the the following umami-parameters are set, activate umami website analytics. |
| `[params]`- `umamiurl` | `Your Umami-URL`| No. i.e. `https://analytics.example.com/`. Please add the trailing slash at the end. |
| `[params]`- `umamisrihash` | `SRI hash` | No. Generate your SRI hash for your complete Umami-URL (incl. script.js). You can do this here: [https://www.srihash.org/](https://www.srihash.org/). |
| `[params]`- `umamiid` | `Umami Website ID` | No. Add Your Umami-Website ID to this variable |
Here is an example `hugo.toml`:
@ -190,6 +194,10 @@ SectionPagesMenu = "main"
ShowCopyright = true
RSSEnabled = true
RSSSections = [ "Posts", "Microposts", "Photos" ]
umamienabled = true
umamiurl = "https://analytics.example.com"
umamisrihash = "xyz"
umamiid = "xxxxxxxxxxxxxxxxxxx-yyyyyyyyyy-zzzzzzzzzzzzz"
[taxonomies]
tag = "tags"

View file

@ -3,6 +3,5 @@
<script src="{{.Site.BaseURL}}js/weblog.js" charset="utf-8" integrity="sha384-aosjEU4mvKU8ONpJImVqClx3r34rc9fegKgyAKyJ3uizf8YWbLUr4mOw2WWcvO4E" crossorigin="anonymous"></script>
{{ partial "custom_javascript.html" . }}
{{ partial "custom_image_handler.html" . }}
{{ template "_internal/google_analytics.html" . }}
</body>
</html>

View file

@ -39,6 +39,8 @@
{{ if .Site.Params.rssenabled }}
<link href="{{ with .OutputFormats.Get "RSS" }}{{ .RelPermalink }}{{ end }}" rel="alternate" type="application/rss+xml" title="{{.Site.Title}}" />
{{ end }}
<script defer src="https://analytics.hadan-it.com/script.js" integrity="sha384-/WQteTtaLX4nU22mvCeTi4Yz3iK/J3yZ2rKq5jDxPMlizEQGzgJOlSofJxh+bx4B" crossorigin="anonymous" data-website-id="3b3d9b22-25d3-476e-b21a-81b3a1f1835f"></script>
{{ if .Site.Params.umamienabled }}
<script defer src="{{ .Site.Params.umamiurl }}script.js" integrity="{{ .Site.Params.umamisrihash }}" crossorigin="anonymous" data-website-id="{{ .Site.Params.umamiid }}"></script>
{{ end }}
</head>
<body class="site">