diff options
| author | Danilo M. <danix@danix.xyz> | 2026-04-22 12:42:56 +0200 |
|---|---|---|
| committer | Danilo M. <danix@danix.xyz> | 2026-04-22 12:42:56 +0200 |
| commit | 631547a75142326a7c71bdf123e1475217a5ad73 (patch) | |
| tree | f3cfef6b3c5b42bf626fc823ddcf63b8dcf4cdbb /layouts/_default | |
| parent | 77ccbe72fad5a4870185fff374f75471c16a9043 (diff) | |
| download | danixxyz-theme-631547a75142326a7c71bdf123e1475217a5ad73.tar.gz danixxyz-theme-631547a75142326a7c71bdf123e1475217a5ad73.zip | |
chore: replace with extracted danix.xyz-hacker theme (danix2-hugo-theme)
Diffstat (limited to 'layouts/_default')
| -rw-r--r-- | layouts/_default/_markup/render-codeblock.html | 23 | ||||
| -rw-r--r-- | layouts/_default/_markup/render-heading.html | 5 | ||||
| -rw-r--r-- | layouts/_default/baseof.html | 130 | ||||
| -rw-r--r-- | layouts/_default/list.html | 39 | ||||
| -rw-r--r-- | layouts/_default/single.html | 54 |
5 files changed, 251 insertions, 0 deletions
diff --git a/layouts/_default/_markup/render-codeblock.html b/layouts/_default/_markup/render-codeblock.html new file mode 100644 index 0000000..6f3e357 --- /dev/null +++ b/layouts/_default/_markup/render-codeblock.html @@ -0,0 +1,23 @@ +{{- $lang := .Type -}} +{{- $hasLang := gt (len $lang) 0 -}} +{{- $highlightLang := $lang -}} +{{- if not $hasLang -}}{{- $highlightLang = "text" -}}{{- end -}} +{{- $opts := dict "lineNos" true "lineNumbersInTable" true -}} + +<div class="code-block-wrapper not-prose"> + {{- if $hasLang -}} + <div class="code-header" data-lang="{{ $lang }}"> + <span class="code-lang-label">{{ $lang }}</span> + <div class="code-copy-wrapper"> + <span role="status" aria-live="polite" class="sr-only code-copy-status"></span> + <button class="code-copy-btn" aria-label="Copy code" data-copy-target> + <i data-feather="copy" class="icon-copy" aria-hidden="true"></i> + <i data-feather="check" class="icon-check hidden" aria-hidden="true"></i> + </button> + </div> + </div> + {{- end -}} + <div class="code-body"> +{{- highlight .Inner $highlightLang $opts -}} + </div> +</div> diff --git a/layouts/_default/_markup/render-heading.html b/layouts/_default/_markup/render-heading.html new file mode 100644 index 0000000..d0d5e05 --- /dev/null +++ b/layouts/_default/_markup/render-heading.html @@ -0,0 +1,5 @@ +{{- if eq .Level 1 -}} +<h1 id="{{ .Anchor }}">{{ .Text | safeHTML }}</h1> +{{- else -}} +<h{{ .Level }} id="{{ .Anchor }}"><span aria-hidden="true" class="heading-prefix">//</span> {{ .Text | safeHTML }}</h{{ .Level }}> +{{- end -}} diff --git a/layouts/_default/baseof.html b/layouts/_default/baseof.html new file mode 100644 index 0000000..482006e --- /dev/null +++ b/layouts/_default/baseof.html @@ -0,0 +1,130 @@ +<!DOCTYPE html> +<html lang="{{ .Lang }}" class="theme-dark"> +<head> + <meta charset="UTF-8"> + <meta name="viewport" content="width=device-width, initial-scale=1.0"> + {{ partial "head-meta.html" . }} + <title>{{ .Title }}{{ if ne .Title .Site.Title }} — {{ .Site.Title }}{{ end }}</title> + + <!-- Favicon --> + <link rel="icon" type="image/png" href="/images/fav.png"> + + <!-- Fonts --> + <link href="https://fonts.googleapis.com/css2?family=IBM+Plex+Sans:wght@400;500;600;700&family=JetBrains+Mono:wght@400;600&family=Oxanium:wght@400;600;700&display=swap" rel="stylesheet"> + + <!-- Feather Icons --> + <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/feather-icons/dist/feather.min.css"> + + <!-- Tailwind CSS --> + {{ $css := resources.Get "css/main.min.css" }} + <link rel="stylesheet" href="{{ $css.RelPermalink }}"> + + <!-- Syntax highlighting (Chroma) --> + {{ $chroma := resources.Get "css/chroma-custom.css" | minify }} + <link rel="stylesheet" href="{{ $chroma.RelPermalink }}"> +</head> +<body class="bg-bg text-text antialiased" data-page-kind="{{ if .IsHome }}home{{ else }}other{{ end }}"> + <!-- Reading progress bar (only on single pages/articles) --> + {{ if eq .Kind "page" }} + <div + id="reading-progress" + class="fixed top-0 left-0 h-1 transition-all duration-100" + style="width: 0%; background: linear-gradient(to right, var(--accent), var(--accent2)); z-index: 9999;" + ></div> + {{ partial "back-to-top.html" . }} + {{ end }} + <!-- Skip to main content link --> + <a href="#main" class="sr-only focus:not-sr-only focus:fixed focus:top-4 focus:left-4 focus:z-50 focus:px-4 focus:py-2 focus:bg-accent focus:text-white focus:rounded"> + {{ i18n "skipToContent" }} + </a> + + <!-- Dot grid background pattern --> + <div class="fixed inset-0 pointer-events-none opacity-5 dot-grid" style=" + background-image: radial-gradient(circle, currentColor 1px, transparent 1px); + background-size: 30px 30px; + z-index: -1; + "></div> + + <!-- Matrix rain canvas background --> + <canvas id="matrix-rain" aria-hidden="true"></canvas> + + <!-- Theme toggle & language toggle (before Alpine loads to prevent flash) --> + <script> + (function() { + const theme = localStorage.getItem('theme') || 'dark'; + const html = document.documentElement; + html.classList.remove('theme-light', 'theme-dark'); + html.classList.add('theme-' + theme); + })(); + </script> + + <!-- Navigation --> + {{ partial "header.html" . }} + + <!-- Main content (spaced for fixed header) --> + <main id="main" class="mt-20 relative z-10"> + {{ block "main" . }}{{ end }} + </main> + + <!-- Footer --> + {{ partial "footer.html" . }} + + <!-- Search modal (desktop and mobile) --> + {{ partial "search-modal.html" . }} + + <!-- Alpine.js --> + <script src="https://cdn.jsdelivr.net/npm/alpinejs@3.x.x/dist/cdn.min.js" defer></script> + + <!-- Feather Icons initialization --> + <script src="https://cdn.jsdelivr.net/npm/feather-icons/dist/feather.min.js"></script> + <script>feather.replace();</script> + + <!-- Theme toggle script --> + {{ $themeScript := resources.Get "js/theme-toggle.js" | minify }} + <script src="{{ $themeScript.RelPermalink }}"></script> + + <!-- Menu script --> + {{ $menuScript := resources.Get "js/menu.js" | minify }} + <script src="{{ $menuScript.RelPermalink }}"></script> + + <!-- Contact form script --> + {{ $contactScript := resources.Get "js/contact-form.js" | minify }} + <script src="{{ $contactScript.RelPermalink }}"></script> + + <!-- 404 Not Found page script --> + {{ $notFoundScript := resources.Get "js/not-found-page.js" | minify }} + <script src="{{ $notFoundScript.RelPermalink }}"></script> + + <!-- Reading progress bar script (on single pages/articles) --> + {{ if eq .Kind "page" }} + {{ $progressScript := resources.Get "js/reading-progress.js" | minify }} + <script src="{{ $progressScript.RelPermalink }}"></script> + {{ end }} + + <!-- Code block copy button --> + {{ if eq .Kind "page" }} + {{ $codeScript := resources.Get "js/code-copy.js" | minify }} + <script src="{{ $codeScript.RelPermalink }}"></script> + {{ end }} + + <!-- Matrix rain background effect --> + {{ with resources.Get "js/matrix-rain.js" }} + {{ $s := . | minify }} + <script src="{{ $s.RelPermalink }}"></script> + {{ end }} + + <!-- Search functionality script --> + {{ $searchScript := resources.Get "js/search.js" | minify }} + <script src="{{ $searchScript.RelPermalink }}"></script> + + <!-- Timeline lazy-reveal (scroll-triggered reveal animation) --> + {{ if eq .Kind "section" }} + {{ $lazyScript := resources.Get "js/article-lazy.js" | minify }} + <script src="{{ $lazyScript.RelPermalink }}"></script> + {{ end }} + + <!-- Tag cloud spiral layout --> + {{ $tagCloudScript := resources.Get "js/tag-cloud-spiral.js" | minify }} + <script src="{{ $tagCloudScript.RelPermalink }}"></script> +</body> +</html> diff --git a/layouts/_default/list.html b/layouts/_default/list.html new file mode 100644 index 0000000..09c0cbb --- /dev/null +++ b/layouts/_default/list.html @@ -0,0 +1,39 @@ +{{ define "main" }} +<div class="mx-auto px-4 py-12 max-w-5xl"> + <h1 class="text-4xl md:text-5xl font-bold text-accent mb-12"> + {{ .Title }} + </h1> + + {{ $pinned := where .Pages "Params.pinned" true }} + {{ $unpinned := where .Pages "Params.pinned" false }} + {{ if eq (len $unpinned) 0 }} + {{ $unpinned = where .Pages "Params.pinned" nil }} + {{ if eq (len $unpinned) 0 }} + {{ $unpinned = where .Pages "Params.pinned" "" }} + {{ end }} + {{ end }} + + {{ $allPages := ($pinned | append $unpinned) }} + + {{ if eq (len $allPages) 0 }} + <div class="py-12 text-center text-text-dim"> + {{ i18n "noRelated" }} + </div> + {{ else }} + <ol class="timeline" aria-label="{{ .Title }}"> + {{ range $i, $page := (sort $pinned "Date" "desc") }} + {{ $side := "left" }} + {{ if eq (mod $i 2) 0 }}{{ $side = "left" }}{{ else }}{{ $side = "right" }}{{ end }} + {{ partial "article-list-item.html" (dict "Page" $page "side" $side) }} + {{ end }} + {{ $offset := len $pinned }} + {{ range $i, $page := (sort $unpinned "Date" "desc") }} + {{ $idx := add $i $offset }} + {{ $side := "left" }} + {{ if eq (mod $idx 2) 0 }}{{ $side = "left" }}{{ else }}{{ $side = "right" }}{{ end }} + {{ partial "article-list-item.html" (dict "Page" $page "side" $side) }} + {{ end }} + </ol> + {{ end }} +</div> +{{ end }} diff --git a/layouts/_default/single.html b/layouts/_default/single.html new file mode 100644 index 0000000..7a1a069 --- /dev/null +++ b/layouts/_default/single.html @@ -0,0 +1,54 @@ +{{ define "main" }} +<article class="mx-auto px-4 py-12 max-w-7xl"> + <div class="grid md:grid-cols-3 gap-8 content-grid"> + <!-- Article section --> + <div class="md:col-span-2 min-w-0"> + <!-- Top article navigation (articles only) --> + {{ if eq .Section "articles" }} + {{ partial "article-nav.html" (dict "page" . "variant" "top") }} + {{ end }} + + <!-- Breadcrumb --> + {{ partial "breadcrumb.html" . }} + + <!-- Article header --> + {{ partial "article-header.html" . }} + + <!-- Article content --> + <div class="prose prose-invert max-w-none mb-12"> + {{ .Content }} + </div> + + <!-- Tags section --> + {{ if .Params.tags }} + <div class="border-t border-border pt-8"> + <h3 class="text-lg font-semibold text-accent mb-4">{{ i18n "tags" }}</h3> + <div class="flex flex-wrap gap-2"> + {{ $lang := .Lang }} + {{ range .Params.tags }} + {{ $tagUrl := printf "/tags/%s/" (. | urlize) }} + {{ if eq $lang "it" }} + {{ $tagUrl = printf "/it/tags/%s/" (. | urlize) }} + {{ end }} + <a + href="{{ $tagUrl }}" + class="inline-flex items-center px-3 py-1 border border-border/30 rounded hover:border-accent/50 hover:text-accent transition-colors text-sm" + > + {{ . }} + </a> + {{ end }} + </div> + </div> + {{ end }} + + <!-- Bottom article navigation (articles only) --> + {{ if eq .Section "articles" }} + {{ partial "article-nav.html" (dict "page" . "variant" "bottom") }} + {{ end }} + </div> + + <!-- Sidebar --> + {{ partial "sidebar.html" . }} + </div> +</article> +{{ end }} |
