summaryrefslogtreecommitdiff
path: root/layouts/shortcodes/links.html
blob: 5acde5d6379a90e45121a81933803af1e7e09cc2 (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
{{- $caption := .Inner }}
{{ $lastLetter := "Dupa" }}
{{ with resources.Get "more/links.yml"}}
{{ with . | transform.Unmarshal }}
<table class="links">

  {{ range (sort .links "Title") }}
  {{ $letter := slicestr .Title 0 1 }}
  {{ if not (eq $letter $lastLetter) }}
  <tr>
    <td colspan="2">
      <hr>
      <h2>{{ $letter}}</h2>
    </td>
    </tr>
  {{ end }}
{{ $lastLetter = $letter }}
  <tr>
    <td class="button">
      {{ if .Button }}
      <a href="{{.Url}}">
        {{- $path := printf "webbuttons_31/%s" .Button}}
        {{- $img := resources.Get $path }}
        <img
          loading="lazy"
          class="webbutton"
          alt="{{ .Name }}"
          src="{{ $img.Permalink }}" 
          width="{{ $img.Width }}" 
          height="{{ $img.Height }}">
      </a>
      {{ end }}
    </td>
    <td style="padding-bottom: 10px">
      <a href="{{.Url}}">
        <b>{{ .Title }}</b><br>
        {{ .Description }}
      </a>
    </td>
  </tr>

  {{ end }}
</links>
{{ end }}
{{ end }}