More site code improvements. Better imgproc, better caption CSS, make post archetype assume we'll have images.
This commit is contained in:
@ -1,20 +1,32 @@
|
||||
{{ $original := .Page.Resources.GetMatch (printf "*%s*" (.Get 0)) }}
|
||||
{{ $imgdata := imageConfig (printf "/content/%s" $original.RelPermalink) }}
|
||||
{{ if (gt $imgdata.Width 1500) }}
|
||||
{{ .Scratch.Set "image" ($original.Resize "1500x") }}
|
||||
{{ else if (gt $imgdata.Height 1500) }}
|
||||
{{ .Scratch.Set "image" ($original.Resize "x1500") }}
|
||||
{{ else }}
|
||||
{{ .Scratch.Set "image" $original }}
|
||||
{{ end }}
|
||||
|
||||
{{ $image := .Scratch.Get "image" }}
|
||||
|
||||
<figure style="padding: 0.25rem; margin: 2rem 0;">
|
||||
<a href="{{ $original.RelPermalink }}">
|
||||
<img style="max-width: 100%; width: auto; height: auto;" src="{{ $image.RelPermalink }}" width="{{ $image.Width }}" height="{{ $image.Height }}">
|
||||
{{- $original := .Page.Resources.GetMatch (printf "*%s*" (.Get 0)) -}}
|
||||
{{- $image := $original -}}
|
||||
{{- $align := "none" -}}
|
||||
{{- $alttext := "" -}}
|
||||
{{- with (.Get 1) -}}
|
||||
{{- if not (eq . "auto") -}}
|
||||
{{- if or (hasSuffix . "x") (hasPrefix . "x") -}}
|
||||
{{ $image = ($image.Resize .) }}
|
||||
{{- else -}}
|
||||
{{ $image = ($image.Fit .) }}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- with (.Get 2) -}}
|
||||
{{- $align = . -}}
|
||||
{{- end -}}
|
||||
{{- with (.Get 3) -}}
|
||||
{{ $alttext = . -}}
|
||||
{{- end -}}
|
||||
{{- if (gt $image.Width 1500) -}}
|
||||
{{- $image = ($image.Resize "1500x") -}}
|
||||
{{- else if (gt $image.Height 1500) -}}
|
||||
{{- $image = ($image.Resize "x1500") -}}
|
||||
{{- end -}}
|
||||
<figure style="float: {{ $align }};">
|
||||
<a href="{{- $original.RelPermalink -}}">
|
||||
<img style="max-width: 100%; width: auto; height: auto;" src="{{- $image.RelPermalink -}}" width="{{- $image.Width -}}" height="{{- $image.Height -}}" alt="{{ $alttext }}"/>
|
||||
</a>
|
||||
<figcaption>
|
||||
{{ .Inner | markdownify }}
|
||||
</figcaption>
|
||||
</figure>
|
||||
<figcaption>
|
||||
{{ .Inner | markdownify }}
|
||||
</figcaption>
|
||||
</figure>
|
||||
|
Reference in New Issue
Block a user