aboutsummaryrefslogtreecommitdiff
path: root/themes/default/layouts/shortcodes/link.html
blob: 4b9b7a6b227760f9950785f4655b2483ce2a91da (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
{{- $source := default "https://example.com/" (.Get "source" | default (.Get 0)) -}}

{{- $host := $source -}}

{{- with (urls.Parse $source).Host -}}
  {{- $host = . -}}
{{- end -}}

{{- $favicon := partial "function-favicon-domain.html" $host -}}

{{- $image := partial "function-fetch-favicons.html"
  (dict
    "Source" $favicon
    "Infix"  ($host | anchorize)
  )
-}}

<link-card>
  <a href="{{ $source }}">
    <img alt="{{ $host }}" src="{{ $image.Permalink }}" />
  </a>
  <article>
    <h2>{{ $host }}</h2>
    <a href="{{ $source }}">
      {{ $source }}
    </a>
  </article>
</link-card>