summaryrefslogtreecommitdiffstats
path: root/themes/danix-xyz-hacker/layouts/partials/article-header.html
blob: b7599096962f437fbe1094a2e8ef729f7c2318cc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
{{ $articleType := .Params.type | default "life" }}
{{ $typeConfig := .Site.Params.articleTypes }}
{{ $typeData := index $typeConfig $articleType }}

<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 type-{{ $articleType }}"
  >
    {{ i18n $articleType }}
  </span>
  {{ end }}

  <!-- Title -->
  <h1 class="text-4xl md:text-5xl font-bold text-accent mb-4">
    {{ .Title }}
  </h1>

  <!-- Metadata -->
  <div class="flex flex-wrap items-center gap-4 text-sm text-text-dim">
    <!-- Publish date -->
    {{ if .PublishDate }}
    <div class="flex items-center gap-1">
      <i data-feather="calendar" class="w-4 h-4"></i>
      <time datetime="{{ .PublishDate.Format "2006-01-02T15:04:05Z07:00" }}">
        {{ .PublishDate.Format "Jan 2, 2006" }}
      </time>
    </div>
    {{ end }}

    <!-- Update date if different -->
    {{ 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 -->
    {{ if .Site.Params.readingTime }}
    <div class="flex items-center gap-1">
      <i data-feather="clock" class="w-4 h-4"></i>
      <span>{{ .ReadingTime }} {{ i18n "min" }} {{ i18n "readingTime" }}</span>
    </div>
    {{ end }}
  </div>
</div>