2022-02-06 00:26:37 +00:00
|
|
|
{{ $url := urls.Parse .Destination }}
|
2022-01-12 03:21:22 +00:00
|
|
|
{{ $altText := .Text }}
|
|
|
|
{{ $caption := .Title }}
|
2022-02-06 00:26:37 +00:00
|
|
|
{{ if findRE "^https?" $url.Scheme }}
|
2022-01-12 03:21:22 +00:00
|
|
|
<figure>
|
2023-01-13 00:41:28 +00:00
|
|
|
<img class="mx-auto my-0 rounded-md" src="{{ $url.String }}" alt="{{ $altText }}" />
|
|
|
|
{{ with $caption }}<figcaption class="text-center">{{ . | markdownify }}</figcaption>{{ end }}
|
2022-01-12 03:21:22 +00:00
|
|
|
</figure>
|
|
|
|
{{ else }}
|
2022-03-07 22:51:19 +00:00
|
|
|
{{ $resource := "" }}
|
|
|
|
{{ if $.Page.Resources.GetMatch ($url.String) }}
|
|
|
|
{{ $resource = $.Page.Resources.GetMatch ($url.String) }}
|
|
|
|
{{ else if resources.GetMatch ($url.String) }}
|
|
|
|
{{ $resource = resources.Get ($url.String) }}
|
|
|
|
{{ end }}
|
|
|
|
{{ with $resource }}
|
2022-02-06 00:26:37 +00:00
|
|
|
<figure>
|
2023-01-13 00:41:28 +00:00
|
|
|
<img
|
|
|
|
class="mx-auto my-0 rounded-md"
|
|
|
|
{{ if or (lt .Width 660) (eq .MediaType.SubType "svg") }}
|
|
|
|
src="{{ .RelPermalink }}"
|
|
|
|
{{ else }}
|
|
|
|
srcset="
|
|
|
|
{{ (.Resize "330x").RelPermalink }} 330w,
|
|
|
|
{{ (.Resize "660x").RelPermalink }} 660w,
|
|
|
|
{{ (.Resize "1024x").RelPermalink }} 1024w,
|
|
|
|
{{ (.Resize "1320x").RelPermalink }} 2x"
|
|
|
|
src="{{ (.Resize "660x").RelPermalink }}"
|
|
|
|
{{ end }}
|
|
|
|
alt="{{ $altText }}"
|
|
|
|
/>
|
|
|
|
{{ with $caption }}<figcaption class="text-center">{{ . | markdownify }}</figcaption>{{ end }}
|
2022-02-06 00:26:37 +00:00
|
|
|
</figure>
|
|
|
|
{{ else }}
|
2022-03-07 22:51:19 +00:00
|
|
|
<figure>
|
2023-01-13 00:41:28 +00:00
|
|
|
<img class="mx-auto my-0 rounded-md" src="{{ $url.String }}" alt="{{ $altText }}" />
|
|
|
|
{{ with $caption }}<figcaption class="text-center">{{ . | markdownify }}</figcaption>{{ end }}
|
2022-03-07 22:51:19 +00:00
|
|
|
</figure>
|
2022-02-06 00:26:37 +00:00
|
|
|
{{ end }}
|
2022-01-12 03:21:22 +00:00
|
|
|
{{ end }}
|