summaryrefslogtreecommitdiffstats
path: root/themes/danix-xyz-hacker/layouts/partials/sidebar.html
blob: 0d1b8028d5b2a05ee73ea369c4c58bf3a56b8486 (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
<aside class="order-last md:order-none md:col-span-1">
  <!-- Author info widget (optional - can be expanded) -->
  <div class="p-4 border border-border/30 rounded mb-6">
    <h3 class="text-lg font-semibold text-accent mb-3">{{ i18n "author" }}</h3>
    <p class="text-text-dim text-sm leading-relaxed">
      {{ .Site.Params.author }}
    </p>
  </div>

  <!-- Related posts widget (articles only) -->
  {{ if and .Site.Params.relatedPosts (eq .Type "articles") }}
  {{ $related := first 5 (.Site.RegularPages.Related .) }}
  <div class="p-4 border border-border/30 rounded mb-6">
    <h3 class="text-lg font-semibold text-accent mb-3">{{ i18n "relatedPosts" }}</h3>
    {{ if $related }}
    <ul class="space-y-3">
      {{ range $related }}
      {{ $articleType := .Params.type | default "life" }}
      {{ $excerpt := .Description | default .Summary }}
      <li
        class="pl-3 border-l-2"
        style="border-color: var(--type-{{ $articleType }});"
      >
        <a href="{{ .RelPermalink }}" class="text-sm hover:text-accent transition-colors leading-snug block">
          {{ .Title }}
          <time class="text-text-dim/60 ml-1" datetime="{{ .PublishDate.Format "2006-01-02T15:04:05Z07:00" }}">
            · {{ .PublishDate.Format "Jan 2006" }}
          </time>
        </a>
        {{ if $excerpt }}
        <p class="text-xs text-text-dim/70 leading-snug mt-0.5 line-clamp-1">
          {{ $excerpt | plainify | truncate 60 }}
        </p>
        {{ end }}
      </li>
      {{ end }}
    </ul>
    {{ else }}
    <p class="text-sm text-text-dim">{{ i18n "noRelated" }}</p>
    {{ end }}
  </div>
  {{ end }}
</aside>