Rewrite the figures/image template to use the new figures in the termlite theme

This commit is contained in:
Eryn Wells 2024-11-25 09:52:22 -08:00
parent 73aaf24f91
commit e3b93e5e0f
2 changed files with 20 additions and 31 deletions

View file

@ -17,35 +17,24 @@
{{ errorf "No images found for name(s) parameter" }} {{ errorf "No images found for name(s) parameter" }}
{{- end -}} {{- end -}}
{{ with $item := index $imgs 0 }} {{- $size := .Get "size" | default "full" -}}
<figure class="figure figure--{{ $item.ResourceType }}{{ with $class }} {{ . }}{{ end }}">
<div class="figure__container">
{{ if eq $item.ResourceType "image" }}
{{- $processedImage := $item -}}
{{- if $shouldResize -}}
{{ $processedImage = $item.Fit "1280x1280" }}
{{- end -}}
{{- $altText := $item.Params.alt | default $item.Title -}} {{ if in (slice "full" "main") $size }}
<a href="{{ $item.RelPermalink }}"> {{
<img src="{{ $processedImage.RelPermalink }}" partial "page/figures/fullwidth.html" (dict
{{- with $altText }} alt="{{ . }}"{{- end }} "page" $.Page
{{- with $item.Title }} title="{{ . }}"{{- end }}> "name" (.Get "name")
</a> "size" $size
{{ else if eq $item.ResourceType "video" }} "shouldShowTitle" (.Get "shouldShowTitle" | default true)
<video controls width="100%"> )
<source src="{{ $item.RelPermalink }}" type="{{ $item.MediaType.Type }}"> }}
</video> {{ else if eq $size "small" }}
{{- end }} {{
</div> partial "page/figures/small.html" (dict
{{ if $shouldShowTitle -}} "page" $.Page
{{- with $item -}} "name" (.Get "name")
{{- if gt (len .Title) 0 -}} "size" $size
<figcaption>{{ .Title | markdownify }}</figcaption> "shouldShowTitle" (.Get "shouldShowTitle" | default true)
{{- end -}} )
{{- end -}} }}
{{- end }}
</figure>
{{ else }}
{{ errorf "Found nil in items list for %s" $.Page.Permalink }}
{{ end }} {{ end }}

@ -1 +1 @@
Subproject commit b7ae6211ce477835ffbd0da7ea958bb4a4d5c8e7 Subproject commit 502aa408d9775d73c1bd75b199897ddbd71e3e28