Clean up style to mimic existing site.

This commit is contained in:
2023-08-31 02:29:40 +00:00
parent 78859c7ccc
commit 8bf98e683c
19 changed files with 112 additions and 28 deletions

View File

@ -1,32 +1,26 @@
{{ $original := .Page.Resources.GetMatch (printf "*%s*" (.Get 0)) }}
{{ $image := $original }}
{{ $align := "none" }}
{{/* Set the height, width, and alignment properties */}}
{{ with (.Get 1) }}
{{ if not (eq . "auto") }}
{{ if or (hasSuffix . "x") (hasPrefix . "x")}}
{{- $original := .Page.Resources.GetMatch (printf "*%s*" (.Get 0)) -}}
{{- $image := $original -}}
{{- $align := "none" -}}
{{- with (.Get 1) -}}
{{- if not (eq . "auto") -}}
{{- if or (hasSuffix . "x") (hasPrefix . "x") -}}
{{ $image = ($image.Resize .) }}
{{ else}}
{{- else -}}
{{ $image = ($image.Fit .) }}
{{ end }}
{{ end }}
{{ end }}
{{ with (.Get 2) }}
{{ $align = . }}
{{ end }}
{{ if (gt $image.Width 1500) }}
{{ $image = ($image.Resize "1500x") }}
{{ else if (gt $image.Height 1500) }}
{{ $image = ($image.Resize "x1500") }}
{{ end }}
<figure style="padding: 0.25rem; margin: 2rem 0; float: {{ $align }}">
<a href="{{ $original.RelPermalink }}">
<img style="max-width: 100%; width: auto; height: auto;" src="{{ $image.RelPermalink }}" width="{{ $image.Width }}" height="{{ $image.Height }}">
{{- end -}}
{{- end -}}
{{- end -}}
{{- with (.Get 2) -}}
{{- $align = . -}}
{{- end -}}
{{- if (gt $image.Width 1500) -}}
{{- $image = ($image.Resize "1500x") -}}
{{- else if (gt $image.Height 1500) -}}
{{- $image = ($image.Resize "x1500") -}}
{{- end -}}
<figure style="padding: 0.25rem; margin: 2rem 0; float: {{- $align -}}">
<a href="{{- $original.RelPermalink -}}">
<img style="max-width: 100%; width: auto; height: auto;" src="{{- $image.RelPermalink -}}" width="{{- $image.Width -}}" height="{{- $image.Height -}}">
</a>
<figcaption>
{{ .Inner | markdownify }}