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

64 lines
1.9 KiB
HTML
Raw Normal View History

{{- /*
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 . ) }}
2025-02-20 01:24:28 +01:00
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>
2025-04-09 10:15:56 +02:00
{{- partialCached "text/item-title.html" ( dict "pc" .pc "sc" .sc "class" "article-header" ) .File.Filename -}}
</div>
{{ with ( .pc.Resources.GetMatch .pc.Params.featured_image ) }}
<p class="attr">
{{- with .Params.attrlink -}}<a href="{{ . }}" target="_blank" rel="noopener">{{- end -}}
{{- .Params.attr | safeHTML -}}
{{- if .Params.attrlink -}}</a>{{- end -}}
{{- if .Params.attrlicence }} (
{{- with .Params.attrlicencelink -}}
<a href="{{ . }}" target="_blank" rel="noopener">
{{- end -}}
{{- .Params.attrlicence -}}
{{- if .Params.attrlicencelink -}}
</a>
{{- end -}}
)
{{- end -}}
<p>
{{ end }}
</div>