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:
parent
c89fe66332
commit
91b18c0f04
80 changed files with 101 additions and 32 deletions
|
@ -9,16 +9,9 @@
|
|||
<!------ ADD PAGE SPECIFIC HEADERS ------->
|
||||
{{ block "header" . }} {{ end }}
|
||||
|
||||
<!-- ADD GOOGLE ANALYTICS IF ENABLED -->
|
||||
{{ if site.GoogleAnalytics }}
|
||||
<!-- 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 }}
|
||||
<!--================= add analytics if enabled =========================-->
|
||||
{{- partial "analytics.html" . -}}
|
||||
|
||||
</head>
|
||||
|
||||
<body data-spy="scroll" data-target="#TableOfContents" data-offset="80">
|
||||
|
@ -45,5 +38,9 @@
|
|||
|
||||
<!------- ADD PAGE SPECIFIC SCRIPTS ------>
|
||||
{{ block "scripts" . }} {{ end }}
|
||||
|
||||
<!------ IF WANTED, ADD SUPPORT LINKS -------->
|
||||
{{- partial "misc/support.html" . -}}
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
@ -29,16 +29,8 @@
|
|||
<!--================= custom style overrides =========================-->
|
||||
<link rel="stylesheet" href="{{ "/css/style.css" | relURL }}"/>
|
||||
|
||||
<!-- Add Google Analytics if enabled in configuration -->
|
||||
{{ if site.GoogleAnalytics }}
|
||||
<!-- 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 }}
|
||||
<!--================= add analytics if enabled =========================-->
|
||||
{{- partial "analytics.html" . -}}
|
||||
</head>
|
||||
<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/home.js" | relURL }}"></script>
|
||||
<script src="{{ "/js/jquery.filterizr.min.js" | relURL }}"></script>
|
||||
|
||||
<!------ ADD SUPPORT LINKS -------->
|
||||
{{- partial "misc/support.html" . -}}
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
|
46
layouts/partials/analytics.html
Normal file
46
layouts/partials/analytics.html
Normal file
|
@ -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/plyr.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://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 =========================-->
|
||||
{{/* 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">
|
||||
<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 defer src="https://cdn.jsdelivr.net/npm/katex@0.11.1/dist/contrib/auto-render.min.js" integrity="sha384-kWPLUVMOks5AQFrykwIup5lo0m3iMkkHrD0uJ4H5cjeGihAutqP0yW0J6dpFiVkI" crossorigin="anonymous"
|
||||
onload="renderMathInElement(document.body);">
|
||||
<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>
|
||||
|
|
16
layouts/partials/misc/support.html
Normal file
16
layouts/partials/misc/support.html
Normal file
|
@ -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/plyr.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>
|
||||
|
|
6
static/fontawesome/css/all.min.css
vendored
Normal file
6
static/fontawesome/css/all.min.css
vendored
Normal file
File diff suppressed because one or more lines are too long
BIN
static/fontawesome/webfonts/fa-brands-400.ttf
Normal file
BIN
static/fontawesome/webfonts/fa-brands-400.ttf
Normal file
Binary file not shown.
BIN
static/fontawesome/webfonts/fa-brands-400.woff2
Normal file
BIN
static/fontawesome/webfonts/fa-brands-400.woff2
Normal file
Binary file not shown.
BIN
static/fontawesome/webfonts/fa-regular-400.ttf
Normal file
BIN
static/fontawesome/webfonts/fa-regular-400.ttf
Normal file
Binary file not shown.
BIN
static/fontawesome/webfonts/fa-regular-400.woff2
Normal file
BIN
static/fontawesome/webfonts/fa-regular-400.woff2
Normal file
Binary file not shown.
BIN
static/fontawesome/webfonts/fa-solid-900.ttf
Normal file
BIN
static/fontawesome/webfonts/fa-solid-900.ttf
Normal file
Binary file not shown.
BIN
static/fontawesome/webfonts/fa-solid-900.woff2
Normal file
BIN
static/fontawesome/webfonts/fa-solid-900.woff2
Normal file
Binary file not shown.
BIN
static/fontawesome/webfonts/fa-v4compatibility.ttf
Normal file
BIN
static/fontawesome/webfonts/fa-v4compatibility.ttf
Normal file
Binary file not shown.
BIN
static/fontawesome/webfonts/fa-v4compatibility.woff2
Normal file
BIN
static/fontawesome/webfonts/fa-v4compatibility.woff2
Normal file
Binary file not shown.
1
static/js/katex.min.js
vendored
1
static/js/katex.min.js
vendored
File diff suppressed because one or more lines are too long
BIN
static/katex/fonts/KaTeX_AMS-Regular.ttf
Normal file
BIN
static/katex/fonts/KaTeX_AMS-Regular.ttf
Normal file
Binary file not shown.
BIN
static/katex/fonts/KaTeX_AMS-Regular.woff
Normal file
BIN
static/katex/fonts/KaTeX_AMS-Regular.woff
Normal file
Binary file not shown.
BIN
static/katex/fonts/KaTeX_AMS-Regular.woff2
Normal file
BIN
static/katex/fonts/KaTeX_AMS-Regular.woff2
Normal file
Binary file not shown.
BIN
static/katex/fonts/KaTeX_Caligraphic-Bold.ttf
Normal file
BIN
static/katex/fonts/KaTeX_Caligraphic-Bold.ttf
Normal file
Binary file not shown.
BIN
static/katex/fonts/KaTeX_Caligraphic-Bold.woff
Normal file
BIN
static/katex/fonts/KaTeX_Caligraphic-Bold.woff
Normal file
Binary file not shown.
BIN
static/katex/fonts/KaTeX_Caligraphic-Bold.woff2
Normal file
BIN
static/katex/fonts/KaTeX_Caligraphic-Bold.woff2
Normal file
Binary file not shown.
BIN
static/katex/fonts/KaTeX_Caligraphic-Regular.ttf
Normal file
BIN
static/katex/fonts/KaTeX_Caligraphic-Regular.ttf
Normal file
Binary file not shown.
BIN
static/katex/fonts/KaTeX_Caligraphic-Regular.woff
Normal file
BIN
static/katex/fonts/KaTeX_Caligraphic-Regular.woff
Normal file
Binary file not shown.
BIN
static/katex/fonts/KaTeX_Caligraphic-Regular.woff2
Normal file
BIN
static/katex/fonts/KaTeX_Caligraphic-Regular.woff2
Normal file
Binary file not shown.
BIN
static/katex/fonts/KaTeX_Fraktur-Bold.ttf
Normal file
BIN
static/katex/fonts/KaTeX_Fraktur-Bold.ttf
Normal file
Binary file not shown.
BIN
static/katex/fonts/KaTeX_Fraktur-Bold.woff
Normal file
BIN
static/katex/fonts/KaTeX_Fraktur-Bold.woff
Normal file
Binary file not shown.
BIN
static/katex/fonts/KaTeX_Fraktur-Bold.woff2
Normal file
BIN
static/katex/fonts/KaTeX_Fraktur-Bold.woff2
Normal file
Binary file not shown.
BIN
static/katex/fonts/KaTeX_Fraktur-Regular.ttf
Normal file
BIN
static/katex/fonts/KaTeX_Fraktur-Regular.ttf
Normal file
Binary file not shown.
BIN
static/katex/fonts/KaTeX_Fraktur-Regular.woff
Normal file
BIN
static/katex/fonts/KaTeX_Fraktur-Regular.woff
Normal file
Binary file not shown.
BIN
static/katex/fonts/KaTeX_Fraktur-Regular.woff2
Normal file
BIN
static/katex/fonts/KaTeX_Fraktur-Regular.woff2
Normal file
Binary file not shown.
BIN
static/katex/fonts/KaTeX_Main-Bold.ttf
Normal file
BIN
static/katex/fonts/KaTeX_Main-Bold.ttf
Normal file
Binary file not shown.
BIN
static/katex/fonts/KaTeX_Main-Bold.woff
Normal file
BIN
static/katex/fonts/KaTeX_Main-Bold.woff
Normal file
Binary file not shown.
BIN
static/katex/fonts/KaTeX_Main-Bold.woff2
Normal file
BIN
static/katex/fonts/KaTeX_Main-Bold.woff2
Normal file
Binary file not shown.
BIN
static/katex/fonts/KaTeX_Main-BoldItalic.ttf
Normal file
BIN
static/katex/fonts/KaTeX_Main-BoldItalic.ttf
Normal file
Binary file not shown.
BIN
static/katex/fonts/KaTeX_Main-BoldItalic.woff
Normal file
BIN
static/katex/fonts/KaTeX_Main-BoldItalic.woff
Normal file
Binary file not shown.
BIN
static/katex/fonts/KaTeX_Main-BoldItalic.woff2
Normal file
BIN
static/katex/fonts/KaTeX_Main-BoldItalic.woff2
Normal file
Binary file not shown.
BIN
static/katex/fonts/KaTeX_Main-Italic.ttf
Normal file
BIN
static/katex/fonts/KaTeX_Main-Italic.ttf
Normal file
Binary file not shown.
BIN
static/katex/fonts/KaTeX_Main-Italic.woff
Normal file
BIN
static/katex/fonts/KaTeX_Main-Italic.woff
Normal file
Binary file not shown.
BIN
static/katex/fonts/KaTeX_Main-Italic.woff2
Normal file
BIN
static/katex/fonts/KaTeX_Main-Italic.woff2
Normal file
Binary file not shown.
BIN
static/katex/fonts/KaTeX_Main-Regular.ttf
Normal file
BIN
static/katex/fonts/KaTeX_Main-Regular.ttf
Normal file
Binary file not shown.
BIN
static/katex/fonts/KaTeX_Main-Regular.woff
Normal file
BIN
static/katex/fonts/KaTeX_Main-Regular.woff
Normal file
Binary file not shown.
BIN
static/katex/fonts/KaTeX_Main-Regular.woff2
Normal file
BIN
static/katex/fonts/KaTeX_Main-Regular.woff2
Normal file
Binary file not shown.
BIN
static/katex/fonts/KaTeX_Math-BoldItalic.ttf
Normal file
BIN
static/katex/fonts/KaTeX_Math-BoldItalic.ttf
Normal file
Binary file not shown.
BIN
static/katex/fonts/KaTeX_Math-BoldItalic.woff
Normal file
BIN
static/katex/fonts/KaTeX_Math-BoldItalic.woff
Normal file
Binary file not shown.
BIN
static/katex/fonts/KaTeX_Math-BoldItalic.woff2
Normal file
BIN
static/katex/fonts/KaTeX_Math-BoldItalic.woff2
Normal file
Binary file not shown.
BIN
static/katex/fonts/KaTeX_Math-Italic.ttf
Normal file
BIN
static/katex/fonts/KaTeX_Math-Italic.ttf
Normal file
Binary file not shown.
BIN
static/katex/fonts/KaTeX_Math-Italic.woff
Normal file
BIN
static/katex/fonts/KaTeX_Math-Italic.woff
Normal file
Binary file not shown.
BIN
static/katex/fonts/KaTeX_Math-Italic.woff2
Normal file
BIN
static/katex/fonts/KaTeX_Math-Italic.woff2
Normal file
Binary file not shown.
BIN
static/katex/fonts/KaTeX_SansSerif-Bold.ttf
Normal file
BIN
static/katex/fonts/KaTeX_SansSerif-Bold.ttf
Normal file
Binary file not shown.
BIN
static/katex/fonts/KaTeX_SansSerif-Bold.woff
Normal file
BIN
static/katex/fonts/KaTeX_SansSerif-Bold.woff
Normal file
Binary file not shown.
BIN
static/katex/fonts/KaTeX_SansSerif-Bold.woff2
Normal file
BIN
static/katex/fonts/KaTeX_SansSerif-Bold.woff2
Normal file
Binary file not shown.
BIN
static/katex/fonts/KaTeX_SansSerif-Italic.ttf
Normal file
BIN
static/katex/fonts/KaTeX_SansSerif-Italic.ttf
Normal file
Binary file not shown.
BIN
static/katex/fonts/KaTeX_SansSerif-Italic.woff
Normal file
BIN
static/katex/fonts/KaTeX_SansSerif-Italic.woff
Normal file
Binary file not shown.
BIN
static/katex/fonts/KaTeX_SansSerif-Italic.woff2
Normal file
BIN
static/katex/fonts/KaTeX_SansSerif-Italic.woff2
Normal file
Binary file not shown.
BIN
static/katex/fonts/KaTeX_SansSerif-Regular.ttf
Normal file
BIN
static/katex/fonts/KaTeX_SansSerif-Regular.ttf
Normal file
Binary file not shown.
BIN
static/katex/fonts/KaTeX_SansSerif-Regular.woff
Normal file
BIN
static/katex/fonts/KaTeX_SansSerif-Regular.woff
Normal file
Binary file not shown.
BIN
static/katex/fonts/KaTeX_SansSerif-Regular.woff2
Normal file
BIN
static/katex/fonts/KaTeX_SansSerif-Regular.woff2
Normal file
Binary file not shown.
BIN
static/katex/fonts/KaTeX_Script-Regular.ttf
Normal file
BIN
static/katex/fonts/KaTeX_Script-Regular.ttf
Normal file
Binary file not shown.
BIN
static/katex/fonts/KaTeX_Script-Regular.woff
Normal file
BIN
static/katex/fonts/KaTeX_Script-Regular.woff
Normal file
Binary file not shown.
BIN
static/katex/fonts/KaTeX_Script-Regular.woff2
Normal file
BIN
static/katex/fonts/KaTeX_Script-Regular.woff2
Normal file
Binary file not shown.
BIN
static/katex/fonts/KaTeX_Size1-Regular.ttf
Normal file
BIN
static/katex/fonts/KaTeX_Size1-Regular.ttf
Normal file
Binary file not shown.
BIN
static/katex/fonts/KaTeX_Size1-Regular.woff
Normal file
BIN
static/katex/fonts/KaTeX_Size1-Regular.woff
Normal file
Binary file not shown.
BIN
static/katex/fonts/KaTeX_Size1-Regular.woff2
Normal file
BIN
static/katex/fonts/KaTeX_Size1-Regular.woff2
Normal file
Binary file not shown.
BIN
static/katex/fonts/KaTeX_Size2-Regular.ttf
Normal file
BIN
static/katex/fonts/KaTeX_Size2-Regular.ttf
Normal file
Binary file not shown.
BIN
static/katex/fonts/KaTeX_Size2-Regular.woff
Normal file
BIN
static/katex/fonts/KaTeX_Size2-Regular.woff
Normal file
Binary file not shown.
BIN
static/katex/fonts/KaTeX_Size2-Regular.woff2
Normal file
BIN
static/katex/fonts/KaTeX_Size2-Regular.woff2
Normal file
Binary file not shown.
BIN
static/katex/fonts/KaTeX_Size3-Regular.ttf
Normal file
BIN
static/katex/fonts/KaTeX_Size3-Regular.ttf
Normal file
Binary file not shown.
BIN
static/katex/fonts/KaTeX_Size3-Regular.woff
Normal file
BIN
static/katex/fonts/KaTeX_Size3-Regular.woff
Normal file
Binary file not shown.
BIN
static/katex/fonts/KaTeX_Size3-Regular.woff2
Normal file
BIN
static/katex/fonts/KaTeX_Size3-Regular.woff2
Normal file
Binary file not shown.
BIN
static/katex/fonts/KaTeX_Size4-Regular.ttf
Normal file
BIN
static/katex/fonts/KaTeX_Size4-Regular.ttf
Normal file
Binary file not shown.
BIN
static/katex/fonts/KaTeX_Size4-Regular.woff
Normal file
BIN
static/katex/fonts/KaTeX_Size4-Regular.woff
Normal file
Binary file not shown.
BIN
static/katex/fonts/KaTeX_Size4-Regular.woff2
Normal file
BIN
static/katex/fonts/KaTeX_Size4-Regular.woff2
Normal file
Binary file not shown.
BIN
static/katex/fonts/KaTeX_Typewriter-Regular.ttf
Normal file
BIN
static/katex/fonts/KaTeX_Typewriter-Regular.ttf
Normal file
Binary file not shown.
BIN
static/katex/fonts/KaTeX_Typewriter-Regular.woff
Normal file
BIN
static/katex/fonts/KaTeX_Typewriter-Regular.woff
Normal file
Binary file not shown.
BIN
static/katex/fonts/KaTeX_Typewriter-Regular.woff2
Normal file
BIN
static/katex/fonts/KaTeX_Typewriter-Regular.woff2
Normal file
Binary file not shown.
File diff suppressed because one or more lines are too long
1
static/katex/katex.min.js
vendored
Normal file
1
static/katex/katex.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
Loading…
Add table
Add a link
Reference in a new issue