diff options
Diffstat (limited to 'themes/default/layouts/shortcodes/link.html')
-rw-r--r-- | themes/default/layouts/shortcodes/link.html | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/themes/default/layouts/shortcodes/link.html b/themes/default/layouts/shortcodes/link.html new file mode 100644 index 0000000..49cd1c4 --- /dev/null +++ b/themes/default/layouts/shortcodes/link.html @@ -0,0 +1,36 @@ +{{- $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 + "Context" .Page + "Source" $favicon + "Infix" ($host | anchorize) + ) +-}} + +<link-card> + <a href="{{ $source }}"> + <img + loading="lazy" + alt="{{ $host }}" + title="{{ $host }}" + height="{{ $image.Height }}" + width="{{ $image.Width }}" + src="{{ $image.Permalink }}" + /> + </a> + <article> + <h2>{{ $host }}</h2> + <a href="{{ $source }}"> + {{ $source }} + </a> + </article> +</link-card> |