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>
|
2022-02-06 00:26:37 +00:00
|
|
|
<img class="my-0 rounded-md" src="{{ $url.String }}" alt="{{ $altText }}" />
|
|
|
|
{{ with $caption }}<figcaption>{{ . | 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>
|
|
|
|
<img
|
|
|
|
class="my-0 rounded-md"
|
|
|
|
srcset="
|
|
|
|
{{ (.Resize "330x").RelPermalink }} 330w,
|
|
|
|
{{ (.Resize "660x").RelPermalink }} 660w,
|
|
|
|
{{ (.Resize "1024x").RelPermalink }} 1024w,
|
|
|
|
{{ (.Resize "1320x").RelPermalink }} 2x"
|
|
|
|
src="{{ (.Resize "660x").RelPermalink }}"
|
|
|
|
alt="{{ $altText }}"
|
|
|
|
/>
|
|
|
|
{{ with $caption }}<figcaption>{{ . | markdownify }}</figcaption>{{ end }}
|
|
|
|
</figure>
|
|
|
|
{{ else }}
|
2022-03-07 22:51:19 +00:00
|
|
|
<figure>
|
|
|
|
<img class="my-0 rounded-md" src="{{ $url.String }}" alt="{{ $altText }}" />
|
|
|
|
{{ with $caption }}<figcaption>{{ . | markdownify }}</figcaption>{{ end }}
|
|
|
|
</figure>
|
2022-02-06 00:26:37 +00:00
|
|
|
{{ end }}
|
2022-01-12 03:21:22 +00:00
|
|
|
{{ end }}
|