Omphaloskepsis-2/layouts/partials/single/main-header/item-tile.html

62 lines
1.6 KiB
HTML

{{- /*
Renders the header tile for an item.
@params pc The page context.
@params sc The site context.
*/
-}}
{{- if ( not ( isset . "sc" ) ) -}}
{{- errorf "No site context received" -}}
{{- end -}}
{{- if ( not ( isset . "pc" ) ) -}}
{{- errorf "No page context received (%q)" .sc.Page.File.Dir -}}
{{- end -}}
{{ with .pc.Params.featured_image }}
<img
class="u-photo"
style="display: none;"
src="
{{- with ( $.pc.Resources.GetMatch . ) -}}
{{ partialCached "images/get-image.html" ( dict "img" . ) . }}
{{- else -}}
{{- . -}}
{{- end -}}
"
itemprop="image"
{{- with ( $.pc.Resources.GetMatch . ) -}}
alt="{{ .Params.alt }}"
{{- end -}}
/>
{{ end }}
<div
class="article-header__featured-image"
{{ with .pc.Params.featured_image }}
{{ with ( $.pc.Resources.GetMatch . ) }}
style="background-image: url({{ partialCached "images/get-image.html" ( dict "img" . ) $.pc }})"
{{ else }}
style="background-image: url({{ . }})"
{{ end }}
{{ end -}}
>
<div class="article-header__title-wrapper">
<a
class="u-url u-uid"
style="display: none"
href="{{ .pc.Permalink }}"
></a>
{{- with .pc.File -}}
{{- partialCached "text/item-title.html" ( dict "pc" $.pc "sc" $.sc "class" "article-header" ) .Filename -}}
{{- else -}}
{{- partial "text/item-title.html" ( dict "pc" $.pc "sc" $.sc "class" "article-header" ) -}}
{{- end -}}
</div>
{{ with ( .pc.Resources.GetMatch .pc.Params.featured_image ) }}
{{- partial "media/attr.html" ( dict "pc" $.pc "sc" $.sc "params" .Params ) -}}
{{ end }}
</div>