1
Fork 0
theorangeone.net-legacy/layouts/partials/list_item.html

29 lines
1.3 KiB
HTML
Raw Normal View History

2021-07-03 10:30:48 +01:00
<div class="media list-page-item mb-3" data-id="{{ .File.UniqueID }}">
2017-10-27 22:56:44 +01:00
{{ if .Params.image }}
<div class="d-none d-md-block align-self-center img-wrapper mr-3">
<a href="{{ .RelPermalink }}" title="{{ .Title }}">
2018-01-04 10:48:54 +00:00
{{ .Scratch.Set "image" .Params.image }}
{{ if hasPrefix .Params.image "resource:" }}
{{ $resource := .Resources.GetMatch (replace .Params.image "resource:" "") }}
{{ .Scratch.Set "image" ($resource.Resize "200x webp").RelPermalink }}
{{ else if hasPrefix .Params.image "unsplash:" }}
{{ $unsplash_id := replace .Params.image "unsplash:" "" }}
{{ $query := querify "client_id" (getenv "UNSPLASH_ACCESS_KEY") }}
{{ $unsplash_data := (getJSON "https://api.unsplash.com/photos/" $unsplash_id "?" $query )}}
{{ .Scratch.Set "image" $unsplash_data.urls.thumb }}
2018-01-04 10:48:54 +00:00
{{ end }}
<img src='{{ .Scratch.Get "image" }}' decoding="async" loading="lazy" referrerpolicy="no-referrer" alt="" />
2017-10-27 22:56:44 +01:00
</a>
</div>
{{ end }}
<div class="media-body">
<h3 class="my-0 h5">
<a href="{{ .RelPermalink }}" title="{{ .Title }}">
{{ .Title }}
</a>
</h3>
<small>{{ partial "content-details.html" . }}</small>
2017-11-09 13:48:28 +00:00
<p>{{ partial "summary.html" . }}</p>
2017-10-27 22:56:44 +01:00
</div>
</div>