From: Danilo M. Date: Wed, 15 Apr 2026 15:25:14 +0000 (+0200) Subject: Fix Hugo v0.160 compatibility: remove os.Getenv and fix template syntax X-Git-Tag: release_22042026-1342~252 X-Git-Url: https://git.danix.xyz/?a=commitdiff_plain;h=7c8971eb481cea544987d4b9ddcb8064d9087766;p=danix.xyz-2.git Fix Hugo v0.160 compatibility: remove os.Getenv and fix template syntax - Remove os.Getenv("THEME") call that violates security policy - Use CSS variables and data attributes for theme-aware badge colors - Update theme-toggle.js to update badge colors on theme switch - Fix .LastMod → .Lastmod (correct API) - Fix template syntax for date comparison in article-header.html Co-Authored-By: Claude Haiku 4.5 --- diff --git a/content/en/articles/_index.md b/content/en/articles/_index.md new file mode 100644 index 0000000..e69de29 diff --git a/content/en/is/here/index.md b/content/en/is/here/index.md new file mode 100644 index 0000000..171b4df --- /dev/null +++ b/content/en/is/here/index.md @@ -0,0 +1,6 @@ ++++ +title = "Talk to me" +date = "2023-02-28T18:12:43+01:00" +type = "page" ++++ + diff --git a/content/it/articles/_index.md b/content/it/articles/_index.md new file mode 100644 index 0000000..e69de29 diff --git a/content/it/is/_index.md b/content/it/is/_index.md new file mode 100644 index 0000000..8b38dbf --- /dev/null +++ b/content/it/is/_index.md @@ -0,0 +1,19 @@ ++++ +title = "about danix.xyz" +author = "Danilo M." +type = "page" +draft = false +date = "2009-06-01T22:04:43+00:00" ++++ + +{{< gravatar mail="danixland@gmail.com" class="image right circle" size=250 >}} + +Welcome to danix.xyz, my name is Danilo but you can call me danix. + +What is this website? Well, **danix.xyz** is my personal website, in here you can read about everything I find interesting, you'll find the code I write, WordPress plugins or themes, php or bash scripts that I use on my systems, and programs that I find interesting. + +I use this website to keep track of all the snippets of code that I tend to forget, I consider this website like my notepad (in the hope that it can turn useful to somebody else). + +I deeply dislike sharing readers data with other companies so you can be sure that I don't collect any data from my readers. I've setup hugo not to track my readers and to instruct other sites referenced on my pages to do so as well. + +Read more about [my Privacy Policy]({{< ref "legal" >}} "Privacy Policy here at danix.xyz"). diff --git a/content/it/is/here/index.md b/content/it/is/here/index.md new file mode 100644 index 0000000..171b4df --- /dev/null +++ b/content/it/is/here/index.md @@ -0,0 +1,6 @@ ++++ +title = "Talk to me" +date = "2023-02-28T18:12:43+01:00" +type = "page" ++++ + diff --git a/themes/danix-xyz-hacker/assets/css/main.min.css b/themes/danix-xyz-hacker/assets/css/main.min.css index 28e42a9..5ab45b1 100644 --- a/themes/danix-xyz-hacker/assets/css/main.min.css +++ b/themes/danix-xyz-hacker/assets/css/main.min.css @@ -1326,10 +1326,19 @@ button, margin-right: auto; } +.my-8 { + margin-top: 2rem; + margin-bottom: 2rem; +} + .mb-12 { margin-bottom: 3rem; } +.mb-2 { + margin-bottom: 0.5rem; +} + .mb-3 { margin-bottom: 0.75rem; } @@ -1350,6 +1359,10 @@ button, margin-top: 4rem; } +.mt-3 { + margin-top: 0.75rem; +} + .block { display: block; } @@ -1439,6 +1452,10 @@ button, transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y)); } +.resize-none { + resize: none; +} + .flex-col { flex-direction: column; } @@ -1485,6 +1502,12 @@ button, margin-bottom: calc(0.5rem * var(--tw-space-y-reverse)); } +.space-y-6 > :not([hidden]) ~ :not([hidden]) { + --tw-space-y-reverse: 0; + margin-top: calc(1.5rem * calc(1 - var(--tw-space-y-reverse))); + margin-bottom: calc(1.5rem * var(--tw-space-y-reverse)); +} + .overflow-y-auto { overflow-y: auto; } @@ -1542,6 +1565,16 @@ button, border-color: var(--border); } +.border-green-300 { + --tw-border-opacity: 1; + border-color: rgb(134 239 172 / var(--tw-border-opacity, 1)); +} + +.border-red-300 { + --tw-border-opacity: 1; + border-color: rgb(252 165 165 / var(--tw-border-opacity, 1)); +} + .bg-accent { background-color: var(--accent); } @@ -1554,6 +1587,16 @@ button, background-color: rgb(0 0 0 / 0.5); } +.bg-green-100 { + --tw-bg-opacity: 1; + background-color: rgb(220 252 231 / var(--tw-bg-opacity, 1)); +} + +.bg-red-100 { + --tw-bg-opacity: 1; + background-color: rgb(254 226 226 / var(--tw-bg-opacity, 1)); +} + .bg-surface { background-color: var(--surface); } @@ -1703,6 +1746,20 @@ button, color: var(--accent); } +.text-bg { + color: var(--bg); +} + +.text-green-800 { + --tw-text-opacity: 1; + color: rgb(22 101 52 / var(--tw-text-opacity, 1)); +} + +.text-red-800 { + --tw-text-opacity: 1; + color: rgb(153 27 27 / var(--tw-text-opacity, 1)); +} + .text-text { color: var(--text); } @@ -1721,6 +1778,14 @@ button, -moz-osx-font-smoothing: grayscale; } +.placeholder-text-dim::-moz-placeholder { + color: var(--text-dim); +} + +.placeholder-text-dim::placeholder { + color: var(--text-dim); +} + .opacity-0 { opacity: 0; } @@ -1837,6 +1902,33 @@ html.theme-light { opacity: 0.9; } +.focus\:border-accent:focus { + border-color: var(--accent); +} + +.focus\:outline-none:focus { + outline: 2px solid transparent; + outline-offset: 2px; +} + +.focus\:ring-1:focus { + --tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color); + --tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color); + box-shadow: var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow, 0 0 #0000); +} + +.focus\:ring-accent:focus { + --tw-ring-color: var(--accent); +} + +.disabled\:cursor-not-allowed:disabled { + cursor: not-allowed; +} + +.disabled\:opacity-50:disabled { + opacity: 0.5; +} + .group:hover .group-hover\:text-accent { color: var(--accent); } diff --git a/themes/danix-xyz-hacker/assets/js/theme-toggle.js b/themes/danix-xyz-hacker/assets/js/theme-toggle.js index 97ed1ce..3a4fda2 100644 --- a/themes/danix-xyz-hacker/assets/js/theme-toggle.js +++ b/themes/danix-xyz-hacker/assets/js/theme-toggle.js @@ -19,6 +19,20 @@ document.addEventListener('DOMContentLoaded', function() { // Add the new theme class htmlElement.classList.add(`theme-${newTheme}`); + // Update article type badge colors + const badges = document.querySelectorAll('[data-theme-dark-color]'); + badges.forEach(badge => { + if (newTheme === 'dark') { + const darkColor = badge.getAttribute('data-theme-dark-color'); + badge.style.color = darkColor; + badge.style.backgroundColor = darkColor + '20'; + } else { + const lightColor = badge.style.color; // Already set to light in HTML + badge.style.color = lightColor; + // backgroundColor stays as is (light color with opacity) + } + }); + // Persist to localStorage localStorage.setItem('theme', newTheme); diff --git a/themes/danix-xyz-hacker/layouts/partials/article-header.html b/themes/danix-xyz-hacker/layouts/partials/article-header.html index 252d87a..10808f9 100644 --- a/themes/danix-xyz-hacker/layouts/partials/article-header.html +++ b/themes/danix-xyz-hacker/layouts/partials/article-header.html @@ -1,15 +1,14 @@ {{ $articleType := .Params.type | default "life" }} {{ $typeConfig := .Site.Params.articleTypes }} {{ $typeData := index $typeConfig $articleType }} -{{ $isDark := strings.Contains (os.Getenv "THEME") "dark" }} -{{ $color := cond $isDark $typeData.color_dark $typeData.color_light }}
{{ if $typeData }} {{ i18n $articleType }} @@ -33,13 +32,17 @@ {{ end }} - {{ if and .LastMod (ne .LastMod.Format "2006-01-02" .PublishDate.Format "2006-01-02") }} -
- - -
+ {{ if .Lastmod }} + {{ $lastmodDate := .Lastmod.Format "2006-01-02" }} + {{ $pubDate := .PublishDate.Format "2006-01-02" }} + {{ if ne $lastmodDate $pubDate }} +
+ + +
+ {{ end }} {{ end }}