summaryrefslogtreecommitdiffstats
path: root/themes/danix-xyz-hacker/layouts/partials/article-nav.html
blob: 8a118b3024cbb7e5fd0fe4f29ffce4b12573c3ec (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
{{ $page    := .page }}
{{ $variant := .variant | default "bottom" }}
{{ $prev := $page.PrevInSection }}
{{ $next := $page.NextInSection }}

{{/* Shell prompt command varies by position */}}
{{ $cmd := "ls ../" }}
{{ if eq $variant "top" }}
  {{ $cmd = "cd" }}
{{ end }}

<nav class="article-nav {{ if eq $variant "bottom" }}mt-8{{ else }}mb-8{{ end }}"
     aria-label="Article navigation">
  <p class="article-nav-prompt" aria-hidden="true">
    [visitor@danix.xyz articles]$ {{ $cmd }}
  </p>
  <div class="article-nav-links">
    {{/* ---- Previous (left side) ---- */}}
    {{ if $prev }}
      <a href="{{ $prev.Permalink }}"
         class="article-nav-link truncate md:max-w-[45%] text-left"
         rel="prev"
         title="{{ $prev.Title }}">
        ◄ {{ $prev.Title }}
      </a>
    {{ else }}
      <span class="article-nav-placeholder text-left" aria-label="Beginning of articles">
        ◄ (beginning)
      </span>
    {{ end }}

    {{/* ---- Next (right side) ---- */}}
    {{ if $next }}
      <a href="{{ $next.Permalink }}"
         class="article-nav-link truncate md:max-w-[45%] text-right"
         rel="next"
         title="{{ $next.Title }}">
        {{ $next.Title }} ►
      </a>
    {{ else }}
      <span class="article-nav-placeholder text-right" aria-label="End of articles">
        (end) ►
      </span>
    {{ end }}
  </div>
</nav>