Compare commits

...

2 Commits

Author SHA1 Message Date
ae707cf5c9 update layouts 2024-01-18 18:31:46 +03:00
e56dc8aebe update configs 2024-01-18 18:31:21 +03:00
3 changed files with 39 additions and 0 deletions

5
Dockerfile Normal file
View File

@ -0,0 +1,5 @@
FROM nginx:stable-alpine
WORKDIR /var/www/html
COPY /public /var/www/html
COPY ./nginx.conf /etc/nginx/conf.d/default.conf

31
layouts/ga.html Normal file
View File

@ -0,0 +1,31 @@
{{- $pc := .Site.Config.Privacy.GoogleAnalytics -}}
{{- if not $pc.Disable }}{{ with .Site.Config.Services.GoogleAnalytics.ID -}}
{{ if hasPrefix . "G-"}}
<script async src="https://www.googletagmanager.com/gtag/js?id={{ . }}"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', '{{ . }}', {
'anonymize_ip': {{- $pc.AnonymizeIP -}},
'user_properties': {
'analyticsCookieId': get_ga_clientid()
}
});
function get_ga_clientid() {
var cookie = {};
document.cookie.split(';').forEach(function(el) {
var splitCookie = el.split('=');
var key = splitCookie[0].trim();
var value = splitCookie[1];
cookie[key] = value;
});
if ('undefined' === typeof cookie['_ga']) {return ''};
return cookie['_ga'].substring(6);
}
</script>
{{- end }}{{ end -}}
{{- end -}}

3
nginx.conf Normal file
View File

@ -0,0 +1,3 @@
server {
root /var/www/html;
}