Add Matomo tracking code
This commit is contained in:
parent
662f7ddad8
commit
2e24f03244
138
layouts/partials/head.html
Normal file
138
layouts/partials/head.html
Normal file
@ -0,0 +1,138 @@
|
|||||||
|
<!-- Basic stuff -->
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<meta name="HandheldFriendly" content="True">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<meta name="referrer" content="no-referrer-when-downgrade">
|
||||||
|
|
||||||
|
{{ partial "title.html" . }}
|
||||||
|
<meta name="description" content="{{ with .Description }}{{ . }}{{ else }}{{if .IsPage}}{{ .Summary }}{{ else }}{{ with .Site.Params.description }}{{ . }}{{ end }}{{ end }}{{ end -}}">
|
||||||
|
|
||||||
|
{{ with .Keywords }}
|
||||||
|
<meta name="keywords" content="{{ range $i, $e := . }}{{ if $i }},{{ end }}{{ $e }}{{ end }}">
|
||||||
|
{{ end }}
|
||||||
|
|
||||||
|
{{ if and (.IsPage) (eq .Params.hidden true)}}
|
||||||
|
<meta name="robots" content="noindex" />
|
||||||
|
{{ end }}
|
||||||
|
|
||||||
|
{{ with .OutputFormats.Get "rss" -}}
|
||||||
|
{{ printf `<link rel="%s" type="%s" href="%s" title="%s" />` .Rel .MediaType.Type .RelPermalink $.Site.Title | safeHTML }}
|
||||||
|
{{ end -}}
|
||||||
|
|
||||||
|
{{ partial "favicons.html" . }}
|
||||||
|
|
||||||
|
{{ $colorTheme := "light" }}
|
||||||
|
{{ $colorThemeSwitcher := true }}
|
||||||
|
|
||||||
|
{{ if and (isset site.Params "colortheme") (ne site.Params.colortheme "") }}
|
||||||
|
{{ $colorTheme = site.Params.colortheme | lower }}
|
||||||
|
{{ end }}
|
||||||
|
|
||||||
|
{{ if isset site.Params "colorthemeswitcher" }}
|
||||||
|
{{ $colorThemeSwitcher = site.Params.colorthemeswitcher }}
|
||||||
|
{{ else }}
|
||||||
|
{{ $colorThemeSwitcher = true }}
|
||||||
|
{{ end }}
|
||||||
|
|
||||||
|
{{ if or (eq $colorThemeSwitcher true) (eq $colorTheme "auto") }}
|
||||||
|
<style>
|
||||||
|
body {
|
||||||
|
visibility: hidden;
|
||||||
|
opacity: 0;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<noscript>
|
||||||
|
<style>
|
||||||
|
body {
|
||||||
|
visibility: visible;
|
||||||
|
opacity: 1;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</noscript>
|
||||||
|
{{end}}
|
||||||
|
|
||||||
|
{{ partial "resource.html" (dict "context" . "type" "css" "filename" "css/main.css") }}
|
||||||
|
{{ partial "resource.html" (dict "context" . "type" "css" "filename" "css/light.css") }}
|
||||||
|
{{ partial "resource.html" (dict "context" . "type" "css" "filename" "css/dark.css") }}
|
||||||
|
|
||||||
|
|
||||||
|
{{ $opts := dict "transpiler" "libsass" "targetPath" "css/style.css" }}
|
||||||
|
{{ range site.Params.customCSS }}
|
||||||
|
{{ $r := "" }}
|
||||||
|
{{ with resources.Get . }}
|
||||||
|
{{ $r = . }}
|
||||||
|
{{ else }}
|
||||||
|
{{ errorf "error: You defined customCSS, but %s was not found, please check your config." . }}
|
||||||
|
{{ end }}
|
||||||
|
|
||||||
|
{{ if $r}}
|
||||||
|
{{ with $r | toCSS $opts | minify | fingerprint }}
|
||||||
|
<link rel="stylesheet" href="{{ .RelPermalink }}" integrity="{{ .Data.Integrity }}" crossorigin="anonymous">
|
||||||
|
{{ end }}
|
||||||
|
{{ end }}
|
||||||
|
{{ end }}
|
||||||
|
|
||||||
|
{{ if site.Params.isso.enabled }} {{/* TODO: maybe we can remove it */}}
|
||||||
|
<style>
|
||||||
|
#isso-thread .textarea {
|
||||||
|
color: #000;
|
||||||
|
}
|
||||||
|
#isso-thread .isso-feedlink {
|
||||||
|
position: relative;
|
||||||
|
z-index: 1;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
{{ end }}
|
||||||
|
|
||||||
|
|
||||||
|
{{ if .Site.Params.copyCodeButton | default true }}
|
||||||
|
{{ partial "resource.html" (dict "context" . "type" "js" "filename" "js/copy-code.js") }}
|
||||||
|
{{ end }}
|
||||||
|
|
||||||
|
{{ range .Site.Params.customJS -}}
|
||||||
|
{{ partial "resource.html" (dict "context" $ "type" "js" "filename" . ) }}
|
||||||
|
{{- end }}
|
||||||
|
|
||||||
|
{{ if isset .Site.Params "webmentions" }}
|
||||||
|
{{ if isset .Site.Params.webmentions "login" }}
|
||||||
|
<link rel="webmention" href="https://webmention.io/{{.Site.Params.webmentions.login}}/webmention" />
|
||||||
|
{{ if eq .Site.Params.webmentions.pingback true }}
|
||||||
|
<link rel="pingback" href="https://webmention.io/{{.Site.Params.webmentions.login}}/xmlrpc" />
|
||||||
|
{{ end }}
|
||||||
|
{{ end }}
|
||||||
|
{{ if isset .Site.Params.webmentions "url" }}
|
||||||
|
<link rel="webmention" href="{{.Site.Params.webmentions.url}}" />
|
||||||
|
{{ end }}
|
||||||
|
{{ end }}
|
||||||
|
|
||||||
|
<!-- Article tags -->
|
||||||
|
<!-- <meta property="article:published_time" content="">
|
||||||
|
<meta property="article:modified_time" content="">
|
||||||
|
<meta property="article:tag" content="">
|
||||||
|
<meta property="article:publisher" content="https://www.facebook.com/XXX"> -->
|
||||||
|
|
||||||
|
{{ if (.Site.Params.GoogleAnalytics.enabled) }}
|
||||||
|
{{ partial "google_analytics.html" . }}
|
||||||
|
{{ end }}
|
||||||
|
|
||||||
|
{{ if (.Site.Params.UmamiAnalytics.enabled ) }}
|
||||||
|
{{ partial "umami_analytics.html" . }}
|
||||||
|
{{ end }}
|
||||||
|
|
||||||
|
{{ partial "head-extra.html" . }}
|
||||||
|
<!-- Matomo -->
|
||||||
|
<script>
|
||||||
|
var _paq = window._paq = window._paq || [];
|
||||||
|
/* tracker methods like "setCustomDimension" should be called before "trackPageView" */
|
||||||
|
_paq.push(['trackPageView']);
|
||||||
|
_paq.push(['enableLinkTracking']);
|
||||||
|
(function() {
|
||||||
|
var u="//matomo.thanwer.com/";
|
||||||
|
_paq.push(['setTrackerUrl', u+'matomo.php']);
|
||||||
|
_paq.push(['setSiteId', '1']);
|
||||||
|
var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0];
|
||||||
|
g.async=true; g.src=u+'matomo.js'; s.parentNode.insertBefore(g,s);
|
||||||
|
})();
|
||||||
|
</script>
|
||||||
|
<!-- End Matomo Code -->
|
||||||
Loading…
Reference in New Issue
Block a user