Add analytics template + Add Ko-Fi donation button + Host fonts locally (#530)
* Add Blogtrottr as newsletter provider * Fixed absLangURL issue with sections in footer * Fixes LaTeX support Makes scripts fully local and only loads them if math:true. Adds support for 18462\latex18462 or even $\latex$ * Added 2 New, Privacy-Friendly Analytics Methods Counter.dev and GoatAnalytics. Google Analytics should keep working the same * Removed 1 CDN * Moved params under features * Added Ko-Fi floating button for support * Refactor analytics code + Add local fonts Signed-off-by: hossainemruz <hossainemruz@gmail.com> Co-authored-by: Pablo Marcos <codebergflamingo@staplehorse.anonaddy.com> Co-authored-by: Emruz Hossain <hossainemruz@gmail.com>
This commit is contained in:
@@ -9,16 +9,9 @@
|
|||||||
<!------ ADD PAGE SPECIFIC HEADERS ------->
|
<!------ ADD PAGE SPECIFIC HEADERS ------->
|
||||||
{{ block "header" . }} {{ end }}
|
{{ block "header" . }} {{ end }}
|
||||||
|
|
||||||
<!-- ADD GOOGLE ANALYTICS IF ENABLED -->
|
<!--================= add analytics if enabled =========================-->
|
||||||
{{ if site.GoogleAnalytics }}
|
{{- partial "analytics.html" . -}}
|
||||||
<!-- Google Analytics v3 ID -->
|
|
||||||
{{ if hasPrefix site.GoogleAnalytics "UA-"}}
|
|
||||||
{{ template "_internal/google_analytics_async.html" . }}
|
|
||||||
{{ else }}
|
|
||||||
<!-- Google Analytics v4 ID -->
|
|
||||||
{{ template "_internal/google_analytics.html" . }}
|
|
||||||
{{ end }}
|
|
||||||
{{ end }}
|
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body data-spy="scroll" data-target="#TableOfContents" data-offset="80">
|
<body data-spy="scroll" data-target="#TableOfContents" data-offset="80">
|
||||||
@@ -45,5 +38,9 @@
|
|||||||
|
|
||||||
<!------- ADD PAGE SPECIFIC SCRIPTS ------>
|
<!------- ADD PAGE SPECIFIC SCRIPTS ------>
|
||||||
{{ block "scripts" . }} {{ end }}
|
{{ block "scripts" . }} {{ end }}
|
||||||
|
|
||||||
|
<!------ IF WANTED, ADD SUPPORT LINKS -------->
|
||||||
|
{{- partial "misc/support.html" . -}}
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
+6
-10
@@ -29,16 +29,8 @@
|
|||||||
<!--================= custom style overrides =========================-->
|
<!--================= custom style overrides =========================-->
|
||||||
<link rel="stylesheet" href="{{ "/css/style.css" | relURL }}"/>
|
<link rel="stylesheet" href="{{ "/css/style.css" | relURL }}"/>
|
||||||
|
|
||||||
<!-- Add Google Analytics if enabled in configuration -->
|
<!--================= add analytics if enabled =========================-->
|
||||||
{{ if site.GoogleAnalytics }}
|
{{- partial "analytics.html" . -}}
|
||||||
<!-- Google Analytics v3 ID -->
|
|
||||||
{{ if hasPrefix site.GoogleAnalytics "UA-"}}
|
|
||||||
{{ template "_internal/google_analytics_async.html" . }}
|
|
||||||
{{ else }}
|
|
||||||
<!-- Google Analytics v4 ID -->
|
|
||||||
{{ template "_internal/google_analytics.html" . }}
|
|
||||||
{{ end }}
|
|
||||||
{{ end }}
|
|
||||||
</head>
|
</head>
|
||||||
<body data-spy="scroll" data-target="#top-navbar" data-offset="100">
|
<body data-spy="scroll" data-target="#top-navbar" data-offset="100">
|
||||||
|
|
||||||
@@ -87,5 +79,9 @@
|
|||||||
<script src="{{ "/js/github-button.js" | relURL }}"></script>
|
<script src="{{ "/js/github-button.js" | relURL }}"></script>
|
||||||
<script src="{{ "/js/home.js" | relURL }}"></script>
|
<script src="{{ "/js/home.js" | relURL }}"></script>
|
||||||
<script src="{{ "/js/jquery.filterizr.min.js" | relURL }}"></script>
|
<script src="{{ "/js/jquery.filterizr.min.js" | relURL }}"></script>
|
||||||
|
|
||||||
|
<!------ ADD SUPPORT LINKS -------->
|
||||||
|
{{- partial "misc/support.html" . -}}
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
@@ -0,0 +1,46 @@
|
|||||||
|
<!-- Add Analytics if enabled in configuration -->
|
||||||
|
{{ 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 }}
|
||||||
|
|
||||||
|
<!-- 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 }}
|
||||||
|
{{ end }}
|
||||||
|
|
||||||
|
<!-- Keep backwards compatibility and consistency with HUGO defaults -->
|
||||||
|
{{ if site.GoogleAnalytics }}
|
||||||
|
{{ template "_internal/google_analytics.html" . }}
|
||||||
|
{{ end }}
|
||||||
@@ -8,11 +8,12 @@
|
|||||||
<link rel="stylesheet" href="{{ "/css/navigators/navbar.css" | relURL }}"/>
|
<link rel="stylesheet" href="{{ "/css/navigators/navbar.css" | relURL }}"/>
|
||||||
<link rel="stylesheet" href="{{ "/css/plyr.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/flag-icon.min.css" | relURL }}"/>
|
||||||
<link rel="stylesheet" href="{{ "/css/katex.min.css" | relURL }}">
|
|
||||||
|
|
||||||
<!--=================== cdn ==============================-->
|
<!--=================== fonts ==============================-->
|
||||||
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Muli:wght@300;400;500;600">
|
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Muli:wght@300;400;500;600">
|
||||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.11.2/css/all.min.css" />
|
|
||||||
|
<!--=================== icons ==============================-->
|
||||||
|
<link rel="stylesheet" href="{{ "/fontawesome/css/all.min.css" | relURL }}"/>
|
||||||
|
|
||||||
<!--================= fab-icon =========================-->
|
<!--================= fab-icon =========================-->
|
||||||
{{/* add favicon only if the site author has provided the the favicon */}}
|
{{/* add favicon only if the site author has provided the the favicon */}}
|
||||||
|
|||||||
@@ -1,5 +1,15 @@
|
|||||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.11.1/dist/katex.min.css" integrity="sha384-zB1R0rpPzHqg7Kpt0Aljp8JPLqbXI3bhnPWROx27a9N0Ll6ZP/+DiW/UqRcLbRjq" crossorigin="anonymous">
|
<link rel="stylesheet" href="{{ "/katex/katex.min.css" | relURL }}">
|
||||||
<script defer src="https://cdn.jsdelivr.net/npm/katex@0.11.1/dist/katex.min.js" integrity="sha384-y23I5Q6l+B6vatafAwxRu/0oK/79VlbSz7Q9aiSZUvyWYIYsd+qj+o24G5ZU2zJz" crossorigin="anonymous"></script>
|
<script type="text/javascript" defer src="{{ "/katex/katex.min.js" | relURL }}"></script>
|
||||||
<script defer src="https://cdn.jsdelivr.net/npm/katex@0.11.1/dist/contrib/auto-render.min.js" integrity="sha384-kWPLUVMOks5AQFrykwIup5lo0m3iMkkHrD0uJ4H5cjeGihAutqP0yW0J6dpFiVkI" crossorigin="anonymous"
|
<script type="text/javascript" defer src="{{ "/katex/auto-render.min.js" | relURL }}" onload="renderMathInElement(document.body);">
|
||||||
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>
|
</script>
|
||||||
|
|||||||
@@ -0,0 +1,16 @@
|
|||||||
|
{{ 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 }}
|
||||||
@@ -5,6 +5,3 @@
|
|||||||
<script type="text/javascript" src="{{ "/js/navbar.js" | relURL }}"></script>
|
<script type="text/javascript" src="{{ "/js/navbar.js" | relURL }}"></script>
|
||||||
<script type="text/javascript" src="{{ "/js/plyr.js" | relURL }}"></script>
|
<script type="text/javascript" src="{{ "/js/plyr.js" | relURL }}"></script>
|
||||||
<script type="text/javascript" src="{{ "/js/main.js" | relURL }}"></script>
|
<script type="text/javascript" src="{{ "/js/main.js" | relURL }}"></script>
|
||||||
|
|
||||||
<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>
|
|
||||||
|
|||||||
Vendored
+6
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.
Vendored
-1
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.
+1
-1
File diff suppressed because one or more lines are too long
Vendored
+1
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user