diff options
Diffstat (limited to 'themes/danix-xyz-hacker/layouts/partials/article-header.html')
| -rw-r--r-- | themes/danix-xyz-hacker/layouts/partials/article-header.html | 23 |
1 files changed, 13 insertions, 10 deletions
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 }} <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> @@ -33,13 +32,17 @@ {{ 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 --> |
