mirror of
https://github.com/BBaoVanC/bobatheme.git
synced 2024-11-13 20:05:58 -06:00
42 lines
1.2 KiB
HTML
42 lines
1.2 KiB
HTML
<figure>
|
|
{{ $media := . | resources.Fingerprint "sha512" }}
|
|
|
|
{{ if eq .MediaType.MainType "image" }}
|
|
|
|
{{ $tiny := $media.Resize "500x" }}
|
|
{{ $small := $media.Resize "800x" }}
|
|
{{ $medium := $media.Resize "1200x" }}
|
|
{{ $large := $media.Resize "1500x" }}
|
|
<img src="{{ $media.Permalink }}"
|
|
alt="{{ $media.Title }}"
|
|
srcset='
|
|
{{ if ge $media.Width "500" }}
|
|
{{ $tiny.RelPermalink}} 500w,
|
|
{{ end }}
|
|
{{ if ge $media.Width "800" }}
|
|
{{ $small.RelPermalink }} 800w,
|
|
{{ end }}
|
|
{{ if ge $media.Width "1200" }}
|
|
{{ $medium.RelPermalink }} 1200w,
|
|
{{ end }}
|
|
{{ if ge $media.Width "1500" }}
|
|
{{ $large.RelPermalink }} 1500w,
|
|
{{ end }}
|
|
{{ $media.RelPermalink }} {{ $media.Width }}w
|
|
'
|
|
/>
|
|
|
|
{{ else if eq .MediaType.MainType "video" }}
|
|
<video controls>
|
|
<source src="{{ $media.Permalink }}" alt="{{ $media.Title }}">
|
|
{{ i18n "browser_no_video_support" }}
|
|
</video>
|
|
{{ end }}
|
|
|
|
{{ with $media.Title }}
|
|
<figcaption>
|
|
{{ . | markdownify }}
|
|
</figcaption>
|
|
{{ end }}
|
|
</figure>
|