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

  {{ range (sort .links "title" "asc") }}
  {{ $letter := slicestr .title 0 1 }}
  {{ $letter = strings.ToUpper $letter }}
  {{ if findRE `\d` $letter }}
  {{ $letter = "0-9" }}
  {{ end}}
  {{ if not (eq $letter $lastLetter) }}

  <tr>
    <td colspan="2">
      <hr>
      <h4>{{ $letter}}</h4>
    </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="{{ .title }}"
          src="{{ $img.Permalink }}" 
          width="{{ $img.Width }}" 
          height="{{ $img.Height }}">
      </a>
      {{ end }}
    </td>
    <td style="padding-bottom: 10px">
      <a href="{{.url}}"> <b>{{ .title }}</b></a>
      {{ if .video }}
        (videos on {{.video}})
      {{ end }}

      <br>
        {{ .description }}
      </a>
    </td>
  </tr>

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