refactor: resource attribution
This commit is contained in:
parent
1a61aeade0
commit
24bfa733ba
12 changed files with 169 additions and 99 deletions
|
@ -1,9 +1,10 @@
|
|||
{{- /*
|
||||
Renders the header tile for an item.
|
||||
Renders the header tile for an item.
|
||||
|
||||
@params pc The page context.
|
||||
@params sc The site context.
|
||||
*/ -}}
|
||||
@params pc The page context.
|
||||
@params sc The site context.
|
||||
*/
|
||||
-}}
|
||||
|
||||
{{- if ( not ( isset . "sc" ) ) -}}
|
||||
{{- errorf "No site context received" -}}
|
||||
|
@ -14,21 +15,26 @@
|
|||
{{- end -}}
|
||||
|
||||
{{ with .pc.Params.featured_image }}
|
||||
<img class="u-photo" style="display: none;" src="
|
||||
<img
|
||||
class="u-photo"
|
||||
style="display: none;"
|
||||
src="
|
||||
{{- with ( $.pc.Resources.GetMatch . ) -}}
|
||||
{{ partialCached "images/get-image.html" ( dict "img" . ) . }}
|
||||
{{- else -}}
|
||||
{{- . -}}
|
||||
{{- end -}}
|
||||
"
|
||||
{{ partialCached "images/get-image.html" ( dict "img" . ) . }}
|
||||
{{- else -}}
|
||||
{{- . -}}
|
||||
{{- end -}}
|
||||
"
|
||||
itemprop="image"
|
||||
{{- with ( $.pc.Resources.GetMatch . ) -}}
|
||||
alt="{{ .Params.alt }}"
|
||||
{{- end -}}
|
||||
{{- with ( $.pc.Resources.GetMatch . ) -}}
|
||||
alt="{{ .Params.alt }}"
|
||||
{{- end -}}
|
||||
/>
|
||||
{{ end }}
|
||||
|
||||
<div class="article-header__featured-image"
|
||||
|
||||
<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 }})"
|
||||
|
@ -36,32 +42,21 @@
|
|||
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 -}}
|
||||
<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 ) }}
|
||||
<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>
|
||||
{{- partial "media/attr.html" ( dict "pc" $.pc "sc" $.sc "params" .Params ) -}}
|
||||
{{ end }}
|
||||
</div>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue