70 lines
2.1 KiB
HTML
70 lines
2.1 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" . ) . }})"
|
|
{{ 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>
|
|
<hgroup class="p-name" itemprop="name">
|
|
<h2 class="article-header__title{{ if gt ( len ( .pc.Title | plainify ) ) 40 }} article-header__title--long{{ end }}">
|
|
{{- .pc.Title | safeHTML -}}
|
|
</h2>
|
|
{{ with .pc.Params.subtitle }}
|
|
<p class="article-header__subtitle">{{ . | safeHTML }}</p>
|
|
{{ end }}
|
|
</hgroup>
|
|
</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>
|