clean up and fix repo

This commit is contained in:
Chris Smith
2024-11-07 10:39:10 +01:00
parent c48b91c28b
commit 3dedb00370
46 changed files with 320 additions and 758 deletions

View File

@@ -0,0 +1,26 @@
{{ define "main" }}
<section class="section-sm text-center">
<div class="container">
<div class="row justify-center">
<div class="sm:col-10 md:col-8 lg:col-6">
<span
class="text-[8rem] block font-bold text-dark dark:text-darkmode-dark">
404
</span>
<h1 class="h2 mb-4">Page not found</h1>
<div class="content">
<p>
The page you are looking for might have been removed, had its name
changed, or is temporarily unavailable.
</p>
</div>
<a
href="{{ site.BaseURL | relLangURL }}"
class="btn btn-primary mt-8">
Back to home
</a>
</div>
</div>
</div>
</section>
{{ end }}

View File

@@ -13,6 +13,7 @@
<!-- style (always cache it) -->
{{ partialCached "essentials/style.html" . }}
</head>
<body>
@@ -29,6 +30,10 @@
{{ end }}
<!-- announcement -->
{{ partialCached "announcement.html" . }}
<!-- header (don't cache it) -->
{{ partial "essentials/header.html" . }}
{{ partial "search-modal.html" (dict "Context" . ) }}
@@ -38,13 +43,11 @@
{{ block "main" . }}{{ end }}
</main>
<!-- cache partial only in production -->
{{ if hugo.IsProduction }}
{{ partialCached "essentials/footer.html" . }}
{{ partialCached "essentials/script.html" . }}
{{ else }}
{{ partial "essentials/footer.html" . }}
{{ partial "essentials/script.html" . }}
{{ end }}
<!-- footer -->
{{ partial "essentials/footer.html" . }}
<!-- script (always cache it) -->
{{ partialCached "essentials/script.html" . }}
</body>
</html>

View File

@@ -3,7 +3,7 @@
<div class="container">
<div class="row justify-center">
<div class="md:col-10 lg:col-7 text-center">
{{ partial "image" (dict "Src" .Params.image "Alt" .Title "Class" "mx-auto mb-6" "Size" "200x200") }}
{{ partial "image" (dict "Src" .Params.image "Context" .Page "Alt" .Title "Class" "mx-auto mb-6" "Size" "200x200") }}
<h2 class="h3 mb-6">{{ .Title }}</h2>
<div class="content">{{ .Content }}</div>
</div>

View File

@@ -6,7 +6,7 @@
<div class="lg:col-4 text-center">
{{ $image:= .Params.image }}
{{ if $image }}
{{ partial "image" (dict "Src" $image "Alt" .Title "Class" "mx-auto" "Size" "200x200") }}
{{ partial "image" (dict "Src" $image "Context" .Page "Alt" .Title "Class" "mx-auto" "Size" "200x200") }}
{{ else if .Params.Email }}
<img
class="mx-auto"

View File

@@ -6,7 +6,7 @@
{{ $image:= .Params.image }}
{{ if $image }}
<div class="mb-10">
{{ partial "image" (dict "Src" $image "Alt" .Title "Class" "w-full rounded") }}
{{ partial "image" (dict "Src" $image "Context" .Page "Alt" .Title "Class" "w-full rounded") }}
</div>
{{ end }}
<h1 class="h2 mb-4">
@@ -20,49 +20,54 @@
>{{ .Params.author }}
</a>
</li>
<li class="mr-4 inline-block">
<i class="fa-regular fa-folder mr-2"></i>
{{ $categories:= .Params.categories }}
{{ range $i,$p:= $categories }}
<a
href="{{ `categories/` | relLangURL }}{{ . | urlize | lower }}/"
class="ms-1"
>{{ . | humanize }}{{ if ne $i (sub (len $categories) 1) }}
{{ ", " }}
{{ end }}
</a>
{{ end }}
</li>
{{ $categories:= .Params.categories }}
{{ if $categories }}
<li class="mr-4 inline-block">
<i class="fa-regular fa-folder mr-2"></i>
{{ range $i,$p:= $categories }}
<a
href="{{ `categories/` | relLangURL }}{{ . | urlize | lower }}/"
class=""
>{{ . | humanize }}{{ if ne $i (sub (len $categories) 1) }}
{{ "," }}
{{ end }}
</a>
{{ end }}
</li>
{{ end }}
<li class="mr-4 inline-block">
<i class="fa-regular fa-clock mr-2"></i>
{{ time.Format ":date_long" .PublishDate }}
</li>
</ul>
<div class="content mb-10">
{{ partial "toc.html" (dict "Class" "blog" "Collapsed" false "TableOfContents" .TableOfContents ) }}
{{ .Content }}
</div>
<div class="row items-start justify-between">
<div class="lg:col-5 mb-10 flex items-center lg:mb-0">
<h5 class="mr-3">{{ i18n "tags" }} :</h5>
<ul>
{{ $tags:= .Params.tags }}
{{ range $i,$p:= $tags }}
<li class="inline-block">
<a
class="bg-theme-light hover:bg-primary dark:bg-darkmode-theme-light dark:hover:bg-darkmode-primary dark:hover:text-dark m-1 block rounded px-3 py-1 hover:text-white"
href="{{ `tags/` | relLangURL }}{{ . | urlize | lower }}/">
{{ . | humanize }}
</a>
</li>
{{ end }}
</ul>
</div>
{{ $tags:= .Params.tags }}
{{ if $tags }}
<div class="lg:col-5 mb-10 flex items-center lg:mb-0">
<h5 class="mr-3">{{ T "tags" }} :</h5>
<ul>
{{ range $i,$p:= $tags }}
<li class="inline-block">
<a
class="bg-theme-light hover:bg-primary dark:bg-darkmode-theme-light dark:hover:bg-darkmode-primary dark:hover:text-dark m-1 block rounded px-3 py-1 hover:text-white"
href="{{ `tags/` | relLangURL }}{{ . | urlize | lower }}/">
{{ . | humanize }}
</a>
</li>
{{ end }}
</ul>
</div>
{{ end }}
<div class="lg:col-4 flex items-center">
{{ partial "social-share" (dict "Context" . "Class" "share-icons" "Title" (i18n "share") "Whatsapp" false "Telegram" false) }}
{{ partial "social-share" (dict "Context" . "Class" "share-icons" "Title" (T "share") "Whatsapp" false "Telegram" false "Linkedin" false "Pinterest" false "Tumblr" false "Vk" false) }}
</div>
</div>
<!-- comments -->
{{ if site.DisqusShortname }}
{{ if site.Config.Services.Disqus.Shortname }}
<div class="mt-20">
{{ template "_internal/disqus.html" . }}
</div>
@@ -75,10 +80,10 @@
{{ $related = $related | shuffle | first 3 }}
{{ with $related }}
<div class="section pb-0">
<h2 class="h3 mb-12">{{ i18n "related_posts" }}</h2>
<h2 class="h3 mb-12">{{ T "related_posts" }}</h2>
<div class="row">
{{ range . }}
<div class="lg:col-4">
<div class="lg:col-4 md:col-6 mb-14">
{{ partial "components/blog-card" . }}
</div>
{{ end }}

View File

@@ -20,7 +20,7 @@
</div>
<div class="mb-6">
<label for="email" class="form-label">
Email <span class="text-red-500">*</span>
Working Mail <span class="text-red-500">*</span>
</label>
<input
id="email"
@@ -31,7 +31,7 @@
</div>
<div class="mb-6">
<label for="message" class="form-label">
Say a few kind words :) <span class="text-red-500">*</span>
Anything else? <span class="text-red-500">*</span>
</label>
<textarea
id="message"

View File

@@ -2,7 +2,7 @@
class="bg-theme-light dark:bg-darkmode-theme-light rounded p-8 text-center">
{{ $image:= .Params.image }}
{{ if $image }}
{{ partial "image" (dict "Src" $image "Alt" .Title "Class" "mx-auto mb-6 rounded" "size" "120x120") }}
{{ partial "image" (dict "Src" $image "Context" .Page "Alt" .Title "Class" "mx-auto mb-6 rounded" "size" "120x120") }}
{{ else if .Params.Email }}
<img
class="mx-auto mb-6 rounded"

View File

@@ -1,35 +1,37 @@
<div class="bg-body dark:bg-darkmode-body">
{{ $image:= .Params.image }}
{{ if $image }}
{{ partial "image" (dict "Src" $image "Alt" .Title "Class" "mb-6 w-full rounded") }}
{{ partial "image" (dict "Src" $image "Context" .Page "Alt" .Title "Class" "mb-6 w-full rounded") }}
{{ end }}
<h4 class="mb-3">
<a href="{{ .RelPermalink }}">
{{ .Title }}
</a>
</h4>
<ul class="mb-4">
<li class="mr-4 inline-block">
<a href="{{ `authors/` | relLangURL }}{{ .Params.Author | urlize }}/">
<i class="fa-regular fa-circle-user mr-2"></i>{{ .Params.author }}
</a>
</li>
<li class="mr-4 inline-block">
<i class="fa-regular fa-folder mr-2"></i>
{{ $categories:= .Params.categories }}
{{ range $i,$p:= $categories }}
<a
href="{{ `categories/` | relLangURL }}{{ . | urlize | lower }}/"
class="ms-1"
>{{ . | humanize }}{{ if ne $i (sub (len $categories) 1) }}
{{ ", " }}
{{ end }}
{{ $categories:= .Params.categories }}
{{ if $categories }}
<ul class="mb-4">
<li class="mr-4 inline-block">
<a href="{{ `authors/` | relLangURL }}{{ .Params.Author | urlize }}/">
<i class="fa-regular fa-circle-user mr-2"></i>{{ .Params.author }}
</a>
{{ end }}
</li>
</ul>
</li>
<li class="mr-4 inline-block">
<i class="fa-regular fa-folder mr-1"></i>
{{ range $i,$p:= $categories }}
<a
href="{{ `categories/` | relLangURL }}{{ . | urlize | lower }}/"
class="ms-1"
>{{ . | humanize }}{{ if ne $i (sub (len $categories) 1) }}
{{ "," }}
{{ end }}
</a>
{{ end }}
</li>
</ul>
{{ end }}
<p class="mb-6">{{ .Summary }}</p>
<a class="btn btn-outline-primary btn-sm" href="{{ .RelPermalink }}">
{{ i18n "read_more" }}
{{ T "read_more" }}
</a>
</div>

View File

@@ -6,7 +6,7 @@
<ul class="{{ $class }} inline-flex space-x-1 capitalize">
<li>
<a class="text-primary dark:text-darkmode-primary" href="{{ $base }}">
{{ i18n "home" | default "Home" }}
{{ T "home" | default "Home" }}
</a>
<span class="inlin-block mr-1">/</span>
</li>
@@ -16,7 +16,7 @@
<a
class="text-primary dark:text-darkmode-primary"
href="{{ .RelPermalink }}">
{{ .Title }}
{{ T (printf "%s" (lower .Title)) | default .Title }}
</a>
<span class="inlin-block mr-1">/</span>
</li>
@@ -24,7 +24,7 @@
{{ end }}
<li>
<span class="text-primary dark:text-darkmode-primary">
{{ $context.Title }}
{{ T (printf "%s" (lower $context.Title)) | default $context.Title }}
</span>
</li>
</ul>

View File

@@ -1,14 +1,14 @@
<!-- theme switcher -->
{{ $class := .Class }}
{{ if site.Params.theme_switcher }}
<div class="theme-switcher {{ $class }}">
<div class="theme-switcher {{ $class }} hidden">
<input id="theme-switcher" data-theme-switcher type="checkbox" />
<label for="theme-switcher">
<span class="sr-only">theme switcher</span>
<span>
<!-- sun -->
<svg
class="absolute left-[4px] top-[4px] z-10 opacity-100 dark:opacity-0"
class="absolute left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2 z-10 opacity-100 dark:opacity-0"
viewBox="0 0 56 56"
fill="#fff"
height="16"
@@ -18,7 +18,7 @@
</svg>
<!-- moon -->
<svg
class="absolute left-[4px] top-[4px] z-10 opacity-0 dark:opacity-100"
class="absolute left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2 z-10 opacity-0 dark:opacity-100"
viewBox="0 0 24 24"
fill="none"
height="16"
@@ -43,12 +43,17 @@
if (localStorage.getItem("theme") === "dark"){darkMode = true}
else if (localStorage.getItem("theme") === "light"){darkMode = false}
if (darkMode){document.documentElement.classList.toggle("dark")}
var themeSwitch = document.querySelectorAll("[data-theme-switcher]");
if (darkMode){document.documentElement.classList.add("dark")}
else {document.documentElement.classList.remove("dark")}
// Show theme switcher after applying theme
document.addEventListener("DOMContentLoaded", () => {
var themeSwitch = document.querySelectorAll("[data-theme-switcher]");
var themeSwitcherContainer = document.querySelector('.theme-switcher');
[].forEach.call(themeSwitch, function (ts) {
ts.checked = darkMode ? true : false;
ts.checked = darkMode;
ts.addEventListener("click", () => {
document.documentElement.classList.toggle("dark");
localStorage.setItem(
@@ -57,6 +62,9 @@
);
});
});
// Now make the switcher visible
themeSwitcherContainer.classList.remove('hidden');
});
</script>
{{ end }}

View File

@@ -56,3 +56,6 @@
<!-- Crisp Chat -->
{{/* {{ partialCached "crisp-chat.html" . }} */}}
<!-- Mermaid -->
{{ partial "mermaid/assets/js" . }}

View File

@@ -111,7 +111,11 @@
{{ if .enable }}
<button
aria-label="search"
{{ if and (not site.Params.navigation_button.enable) (not site.Params.theme_switcher)}}
class="border-border text-dark hover:text-primary dark:border-darkmode-border mr-5 inline-block border-r lg:border-r-0 pr-5 lg:pr-0 text-xl dark:text-white dark:hover:text-darkmode-primary"
{{ else }}
class="border-border text-dark hover:text-primary dark:border-darkmode-border mr-5 inline-block border-r pr-5 text-xl dark:text-white dark:hover:text-darkmode-primary"
{{ end }}
data-target="search-modal">
<i class="fa-solid fa-search"></i>
</button>

View File

@@ -52,3 +52,7 @@
<!-- google adsense -->
{{ partialCached "adsense-script.html" . }}
<!-- cookie consent -->
{{ partialCached "announcement-script.html" . }}

View File

@@ -52,10 +52,10 @@
{{/* main style */}}
{{ $styles = $styles | append (resources.Get "scss/main.scss" | toCSS) }}
{{ $styles = $styles | resources.Concat "css/style.css" }}
{{ $styles = $styles | resources.PostCSS }}
{{ $styles = $styles | css.PostCSS }}
{{ $stylesLazy = $stylesLazy | resources.Concat "css/style-lazy.css" }}
{{ $stylesLazy = $stylesLazy | resources.PostCSS }}
{{ $stylesLazy = $stylesLazy | css.PostCSS }}
{{ if hugo.IsProduction }}
{{ $styles = $styles | resources.ExecuteAsTemplate "css/style.css" . | minify | fingerprint | resources.PostProcess }}

View File

@@ -2,7 +2,7 @@
<div class="container text-center">
<div
class="from-body to-theme-light dark:from-darkmode-body dark:to-darkmode-theme-light rounded-2xl bg-gradient-to-b px-8 py-14">
<h1>{{ .Title | title }}</h1>
<h1>{{ T (printf "%s" (lower .Title)) | default .Title | title }}</h1>
{{ partial "components/breadcrumb" (dict "Context" . "Class" "mt-6") }}
</div>
</div>

View File

@@ -2,7 +2,7 @@
{{ if isset site.Taxonomies "categories" }}
{{ if not (eq (len site.Taxonomies.categories) 0) }}
<div class="mb-8">
<h5 class="mb-6">{{ i18n "categories" }}</h5>
<h5 class="mb-6">{{ T "categories" }}</h5>
<div class="bg-theme-light dark:bg-darkmode-theme-light rounded p-8">
<ul class="space-y-4">
{{ range $name, $items := site.Taxonomies.categories }}

View File

@@ -2,7 +2,7 @@
{{ if isset site.Taxonomies "tags" }}
{{ if not (eq (len site.Taxonomies.tags) 0) }}
<div class="mb-8">
<h5 class="mb-6">Tags</h5>
<h5 class="mb-6">{{ T "tags" }}</h5>
<div class="bg-theme-light dark:bg-darkmode-theme-light rounded p-6">
<ul>
{{ range $name, $items := site.Taxonomies.tags }}