fix-featimage-ratio (#127)
fix #10 Reviewed-on: #127 Co-authored-by: paspo <paolo@asperti.com> Co-committed-by: paspo <paolo@asperti.com>
This commit is contained in:
parent
f8bb05f12e
commit
0603f5df69
@ -39,7 +39,3 @@
|
|||||||
padding-right: 1em;
|
padding-right: 1em;
|
||||||
font-size: 1rem;
|
font-size: 1rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
#content article img {
|
|
||||||
width: 100%;
|
|
||||||
}
|
|
||||||
|
@ -3,7 +3,11 @@
|
|||||||
{{- if not $u.IsAbs -}}
|
{{- if not $u.IsAbs -}}
|
||||||
{{- $path := strings.TrimPrefix "./" $u.Path }}
|
{{- $path := strings.TrimPrefix "./" $u.Path }}
|
||||||
{{- with or (.PageInner.Resources.Get $path) (resources.Get $path) -}}
|
{{- with or (.PageInner.Resources.Get $path) (resources.Get $path) -}}
|
||||||
{{- $src = (.Resize "1400x jpg q50").RelPermalink -}}
|
{{- if gt .Width 1400 -}}
|
||||||
|
{{- $src = (.Resize "1400x webp q50").RelPermalink -}}
|
||||||
|
{{- else -}}
|
||||||
|
{{- $src = (.Process "webp q50").RelPermalink -}}
|
||||||
|
{{- end -}}
|
||||||
{{- with $u.RawQuery -}}
|
{{- with $u.RawQuery -}}
|
||||||
{{- $src = printf "%s?%s" $src . -}}
|
{{- $src = printf "%s?%s" $src . -}}
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
|
@ -26,10 +26,12 @@
|
|||||||
|
|
||||||
<span class="image featured">
|
<span class="image featured">
|
||||||
{{- if in $rasters $img.MediaType.SubType -}}
|
{{- if in $rasters $img.MediaType.SubType -}}
|
||||||
{{- $img = $img.Resize (printf "x%d" $maxHeight) -}}
|
{{- if gt $img.Height $maxHeight -}}
|
||||||
<img src="{{ $img.RelPermalink }}" alt="{{ .Params.image_alt }}" style="max-height: {{ $maxHeight }}px;" />
|
{{- $img = $img.Resize (printf "x%d webp q50" $maxHeight) -}}
|
||||||
|
{{- end -}}
|
||||||
|
<img src="{{ $img.RelPermalink }}" alt="{{ .Params.image_alt }}" {{- if gt $img.Height $img.Width -}}style="width: auto;"{{- end -}} />
|
||||||
{{ else }}
|
{{ else }}
|
||||||
<img src="{{ $img.RelPermalink }}" alt="{{ .Params.image_alt }}" style="max-height: {{ $maxHeight }}px;" />
|
<img src="{{ $img.RelPermalink }}" alt="{{ .Params.image_alt }}" />
|
||||||
{{ end }}
|
{{ end }}
|
||||||
</span>
|
</span>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user