From 7c8971eb481cea544987d4b9ddcb8064d9087766 Mon Sep 17 00:00:00 2001 From: "Danilo M." Date: Wed, 15 Apr 2026 17:25:14 +0200 Subject: Fix Hugo v0.160 compatibility: remove os.Getenv and fix template syntax MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 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 --- .../layouts/partials/article-header.html | 23 ++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) (limited to 'themes/danix-xyz-hacker/layouts') 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 }} -- cgit v1.2.3