Refactor analytics code + Add local fonts

Signed-off-by: hossainemruz <hossainemruz@gmail.com>
This commit is contained in:
hossainemruz 2022-03-14 03:17:40 +06:00
parent 1fd13371ad
commit be2c2c6810
78 changed files with 81 additions and 62 deletions

View file

@ -80,7 +80,7 @@
<script src="{{ "/js/home.js" | relURL }}"></script>
<script src="{{ "/js/jquery.filterizr.min.js" | relURL }}"></script>
<!------ IF WANTED, ADD SUPPORT LINKS -------->
<!------ ADD SUPPORT LINKS -------->
{{- partial "misc/support.html" . -}}
</body>

View file

@ -1,33 +1,46 @@
<!-- Add Analytics if enabled in configuration -->
{{ if eq site.Params.Features.analytics.enable true }}
{{ with site.Params.features.analytics }}
{{ if .enabled }}
<!-- Google Analytics -->
{{ with .google }}
{{ $privacyConfig:= dict (slice "Site" "Config" "Privacy" "GoogleAnalytics") $.Site.Config.Privacy.GoogleAnalytics }}
{{ $analyticsConfig := dict (slice "Site" "GoogleAnalytics") .id }}
{{ template "_internal/google_analytics.html" (merge $privacyConfig $analyticsConfig) }}
{{ end }}
<!-- Google Analytics -->
{{ if site.Params.Features.analytics.Google }}
<!-- Google Analytics v3 ID -->
{{ if hasPrefix site.Params.Features.analytics.Google "UA-"}}
{{ template "_internal/google_analytics_async.html" . }}
<!-- Google Analytics v4 ID -->
{{ else }}
{{ template "_internal/google_analytics.html" . }}
<!-- Counter.dev -->
{{ with .counterDev }}
<script>
if (
!sessionStorage.getItem("_swa") &&
document.referrer.indexOf(location.protocol + "//" + location.host) !== 0
) {
fetch(
"https://counter.dev/track?" +
new URLSearchParams({
referrer: document.referrer,
screen: screen.width + "x" + screen.height,
user: "{{ .id }}",
utcoffset: "1",
})
);
}
sessionStorage.setItem("_swa", "1");
</script>
{{ end }}
<!-- GoatCounter -->
{{ with .goatCounter }}
<script
data-goatcounter="https://{{ .code }}.goatcounter.com/count"
async
src="//gc.zgo.at/count.js"
></script>
{{ end }}
{{ end }}
<!-- Counter.dev -->
{{ if site.Params.Features.analytics.CounterDev }}
<script>if(!sessionStorage.getItem("_swa")&&document.referrer.indexOf(location.protocol+"//"+location.host)!== 0){fetch("https://counter.dev/track?"+new URLSearchParams({referrer:document.referrer,screen:screen.width+"x"+screen.height,user:"{{ site.Params.Features.analytics.CounterDev }}",utcoffset:"1"}))};sessionStorage.setItem("_swa","1");</script>
{{ end }}
<!-- Counter.dev -->
{{ if site.Params.Features.analytics.GoatCounter }}
<script data-goatcounter="https://{{ site.Params.Features.analytics.GoatCounter }}.goatcounter.com/count" async src="//gc.zgo.at/count.js"></script>
{{ end }}
{{ end }}
<!-- Keep backwards compatibility and consistency with HUGO defaults -->
{{ else if site.GoogleAnalytics }}
{{ if hasPrefix site.GoogleAnalytics "UA-"}}
{{ template "_internal/google_analytics_async.html" . }}
{{ else }}
{{ template "_internal/google_analytics.html" . }}
{{ end }}
{{ if site.GoogleAnalytics }}
{{ template "_internal/google_analytics.html" . }}
{{ end }}

View file

@ -8,11 +8,12 @@
<link rel="stylesheet" href="{{ "/css/navigators/navbar.css" | relURL }}"/>
<link rel="stylesheet" href="{{ "/css/plyr.css" | relURL }}"/>
<link rel="stylesheet" href="{{ "/css/flag-icon.min.css" | relURL }}"/>
<link rel="stylesheet" href="{{ "/css/google-fonts.css" | relURL }}">
<!--=================== cdn ==============================-->
<!-- Font Awesome cant be easily converted because the CSS file auto-references the website (../) -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.11.2/css/all.min.css" />
<!--=================== fonts ==============================-->
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Muli:wght@300;400;500;600">
<!--=================== icons ==============================-->
<link rel="stylesheet" href="{{ "/fontawesome/css/all.min.css" | relURL }}"/>
<!--================= fab-icon =========================-->
{{/* add favicon only if the site author has provided the the favicon */}}

View file

@ -1,17 +1,15 @@
<link rel="stylesheet" href="{{ "/css/katex.min.css" | relURL }}">
<script type="text/javascript" defer src="{{ "/js/katex.min.js" | relURL }}"></script>
<script type="text/javascript" defer src="{{ "/js/auto-render.min.js" | relURL }}" onload="renderMathInElement(document.body);"></script>
<script>
renderMathInElement(
document.body,
{
delimiters: [
{left: "$$", right: "$$", display: true},
{left: "\\[", right: "\\]", display: true},
{left: "$", right: "$", display: false},
{left: "\\(", right: "\\)", display: false}
]
}
);
<link rel="stylesheet" href="{{ "/katex/katex.min.css" | relURL }}">
<script type="text/javascript" defer src="{{ "/katex/katex.min.js" | relURL }}"></script>
<script type="text/javascript" defer src="{{ "/katex/auto-render.min.js" | relURL }}" onload="renderMathInElement(document.body);">
renderMathInElement(
document.body,
{
delimiters: [
{left: "$$", right: "$$", display: true},
{left: "\\[", right: "\\]", display: true},
{left: "$", right: "$", display: false},
{left: "\\(", right: "\\)", display: false}
]
}
);
</script>

View file

@ -1,15 +1,16 @@
{{ if eq site.Params.Features.Support.enable true }}
<!-- Enable Ko-Fi floating button -->
{{ if site.Params.Features.Support.KoFi }}
<script src='https://storage.ko-fi.com/cdn/scripts/overlay-widget.js'></script>
<script>
kofiWidgetOverlay.draw('{{ site.Params.Features.Support.KoFi.user }}', {
'type': 'floating-chat',
'floating-chat.donateButton.text': '{{ site.Params.Features.Support.KoFi.text }}',
'floating-chat.donateButton.background-color': '{{ site.Params.Features.Support.KoFi.backgroundcolor }}',
'floating-chat.donateButton.text-color': '{{ site.Params.Features.Support.KoFi.textcolor }}'
});
</script>
{{ with site.Params.features.support }}
{{ if .enabled }}
<!-- Enable Ko-Fi floating button -->
{{ with .kofi }}
<script src='https://storage.ko-fi.com/cdn/scripts/overlay-widget.js'></script>
<script>
kofiWidgetOverlay.draw('{{ .user }}', {
'type': 'floating-chat',
'floating-chat.donateButton.text': '{{ .text }}',
'floating-chat.donateButton.text-color': '{{ .textColor }}',
'floating-chat.donateButton.background-color': '{{ .backgroundColor }}',
});
</script>
{{ end }}
{{ end }}
{{ end }}

6
static/fontawesome/css/all.min.css vendored Normal file

File diff suppressed because one or more lines are too long

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

File diff suppressed because one or more lines are too long

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

File diff suppressed because one or more lines are too long

1
static/katex/katex.min.js vendored Normal file

File diff suppressed because one or more lines are too long