Add layouts/partials/paige/image.html

This commit is contained in:
Will Faught
2023-04-23 21:10:35 -07:00
parent e6d5010efe
commit a79d337674
7 changed files with 518 additions and 272 deletions

View File

@@ -1,7 +1,10 @@
{{ $align := .Get "align" | default "center" }}
{{ $fetchpriority := .Get "fetchpriority" }}
{{ $height := .Get "height" }}
{{ $images := .Get 0 | default (.Get "images") }}
{{ $justify := .Get "justify" | default "center" }}
{{ $linked := .Get "linked" }}
{{ $loading := .Get "loading" }}
{{ $maxheight := .Get "maxheight" }}
{{ $maxwidth := .Get "maxwidth" }}
{{ $process := .Get "process" }}
@@ -40,17 +43,16 @@
{{ else }}
{{ range $resources }}
<div class="col">
{{ partial "paige/a.html" (dict
"content" (partial "paige/img.html" (dict
"class" "img-fluid"
"height" $height
"maxheight" $maxheight
"maxwidth" $maxwidth
"process" $process
"resource" .
"width" $width
))
"href" .RelPermalink
{{ partial "paige/image.html" (dict
"fetchpriority" $fetchpriority
"height" $height
"linked" $linked
"loading" $loading
"maxheight" $maxheight
"maxwidth" $maxwidth
"process" $process
"resource" .
"width" $width
) }}
</div>
{{ end }}
@@ -63,17 +65,16 @@
{{ . }}
{{ else }}
{{ range $resources }}
{{ partial "paige/a.html" (dict
"content" (partial "paige/img.html" (dict
"class" "img-fluid"
"height" $height
"maxheight" $maxheight
"maxwidth" $maxwidth
"process" $process
"resource" .
"width" $width
))
"href" .RelPermalink
{{ partial "paige/image.html" (dict
"fetchpriority" $fetchpriority
"height" $height
"linked" $linked
"loading" $loading
"maxheight" $maxheight
"maxwidth" $maxwidth
"process" $process
"resource" .
"width" $width
) }}
{{ end }}
{{ end }}

View File

@@ -5,6 +5,7 @@
{{ $fetchpriority := .Get "fetchpriority" }}
{{ $height := .Get "height" }}
{{ $link := .Get "link" }}
{{ $linked := .Get "linked" }}
{{ $loading := .Get "loading" }}
{{ $maxheight := .Get "maxheight" }}
{{ $maxwidth := .Get "maxwidth" }}
@@ -15,43 +16,22 @@
{{ $title := .Get "title" }}
{{ $width := .Get "width" }}
{{ if not $src }}
{{ errorf "paige/image: no src" }}
{{ end }}
{{ if $class }}
{{ $class = split $class " " }}
{{ else }}
{{ $class = slice }}
{{ end }}
{{ $class = $class | append "img-fluid" | uniq | sort }}
{{ $class = delimit $class " " }}
{{ $content := partial "paige/img.html" (dict
{{ partial "paige/image.html" (dict
"alt" $alt
"breakpoints" $breakpoints
"class" $class
"densities" $densities
"fetchpriority" $fetchpriority
"height" $height
"link" $link
"linked" $linked
"loading" $loading
"maxheight" $maxheight
"maxwidth" $maxwidth
"process" $process
"page" .Page
"sizes" $sizes
"src" $src
"srcset" $srcset
"title" $title
"width" $width
) }}
{{ if $link }}
{{ $content = partial "paige/a.html" (dict
"content" $content
"href" $link
) }}
{{ end }}
<div class="paige-image">{{ $content }}</div>