]> danix's work - danix.xyz-2.git/commitdiff
Fix Hugo v0.160 compatibility: remove os.Getenv and fix template syntax
authorDanilo M. <redacted>
Wed, 15 Apr 2026 15:25:14 +0000 (17:25 +0200)
committerDanilo M. <redacted>
Wed, 15 Apr 2026 15:25:14 +0000 (17:25 +0200)
- 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 <redacted>
content/en/articles/_index.md [new file with mode: 0644]
content/en/is/here/index.md [new file with mode: 0644]
content/it/articles/_index.md [new file with mode: 0644]
content/it/is/_index.md [new file with mode: 0644]
content/it/is/here/index.md [new file with mode: 0644]
themes/danix-xyz-hacker/assets/css/main.min.css
themes/danix-xyz-hacker/assets/js/theme-toggle.js
themes/danix-xyz-hacker/layouts/partials/article-header.html

diff --git a/content/en/articles/_index.md b/content/en/articles/_index.md
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/content/en/is/here/index.md b/content/en/is/here/index.md
new file mode 100644 (file)
index 0000000..171b4df
--- /dev/null
@@ -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 (file)
index 0000000..e69de29
diff --git a/content/it/is/_index.md b/content/it/is/_index.md
new file mode 100644 (file)
index 0000000..8b38dbf
--- /dev/null
@@ -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 (file)
index 0000000..171b4df
--- /dev/null
@@ -0,0 +1,6 @@
++++
+title = "Talk to me"
+date = "2023-02-28T18:12:43+01:00"
+type = "page"
++++
+
index 28e42a9e5bd24c03a4ec74fad690ff59922552e1..5ab45b157687baa474a693a94e37b9bf09dd8a9b 100644 (file)
@@ -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);
 }
index 97ed1ce68d048bf277fd27d45ff20adeb2a42a3f..3a4fda2ba00bc48440e330656bb86f6c98e2696e 100644 (file)
@@ -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);
 
index 252d87a6e034b756383843c2200ef28c0778890e..10808f96c9a8a5118ef49220badfefec546cf3fa 100644 (file)
@@ -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 }}
 
 <div class="mb-8 pb-8 border-b border-border">
   <!-- Type badge -->
   {{ if $typeData }}
   <span
     class="inline-flex items-center px-3 py-1 rounded text-sm font-semibold mb-4 transition-colors"
-    style="color: {{ $color }}; background-color: {{ $color }}20;"
+    style="color: {{ $typeData.color_light }}; background-color: {{ $typeData.color_light }}20;"
+    data-theme-dark-color="{{ $typeData.color_dark }}"
   >
     {{ i18n $articleType }}
   </span>
     {{ end }}
 
     <!-- Update date if different -->
-    {{ if and .LastMod (ne .LastMod.Format "2006-01-02" .PublishDate.Format "2006-01-02") }}
-    <div class="flex items-center gap-1">
-      <i data-feather="edit-2" class="w-4 h-4"></i>
-      <time datetime="{{ .LastMod.Format "2006-01-02T15:04:05Z07:00" }}">
-        {{ .LastMod.Format "Jan 2, 2006" }}
-      </time>
-    </div>
+    {{ if .Lastmod }}
+      {{ $lastmodDate := .Lastmod.Format "2006-01-02" }}
+      {{ $pubDate := .PublishDate.Format "2006-01-02" }}
+      {{ if ne $lastmodDate $pubDate }}
+      <div class="flex items-center gap-1">
+        <i data-feather="edit-2" class="w-4 h-4"></i>
+        <time datetime="{{ .Lastmod.Format "2006-01-02T15:04:05Z07:00" }}">
+          {{ .Lastmod.Format "Jan 2, 2006" }}
+        </time>
+      </div>
+      {{ end }}
     {{ end }}
 
     <!-- Reading time -->