refactor templates layout
@see https://gohugo.io/templates/new-templatesystem-overview/
This commit is contained in:
parent
a83f339dc8
commit
230c46411b
102 changed files with 2 additions and 2 deletions
67
layouts/_partials/single/main-header/item-tile.html
Normal file
67
layouts/_partials/single/main-header/item-tile.html
Normal file
|
@ -0,0 +1,67 @@
|
|||
{{- /*
|
||||
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" . ) .Title -}}
|
||||
{{- 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" . ) .Title -}})"
|
||||
{{ else }}
|
||||
{{- if $.pc.Page.Resources -}}
|
||||
{{- errorf "No Page Resource found for src '%q' (%q).\n\n\tAvailable Page Resources are:\n\t\t%v" . $.pc.Page.File.Path $.pc.Page.Resources -}}
|
||||
{{- else -}}
|
||||
{{- warnf "No Page Resource found for src '%q' (%q)." . $.pc.Page.File.Path -}}
|
||||
{{- end -}}
|
||||
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 -}}
|
||||
{{- partial "text/item-title.html" ( dict "pc" $.pc "sc" $.sc "class" "article-header" ) -}}
|
||||
{{- 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>
|
Loading…
Add table
Add a link
Reference in a new issue