enable image processing for primary images on site ; this reduces page size by a factor of at least 10

This commit is contained in:
KemoNine 2022-12-04 11:05:38 -05:00
parent a5c4b59b3d
commit b5184f0ca7
3 changed files with 13 additions and 9 deletions

View file

@ -53,7 +53,11 @@
{{ if .Params.image }}
<div class="xs-p2 center">
<figure itemprop="associatedMedia" itemscope itemtype="http://schema.org/ImageObject">
<img itemprop="image" src="{{ .Params.image }}" {{ if .Params.imagecaption }}alt="{{.Params.imagecaption}}"{{ end }} style="max-width:480px"/>
{{ with .Resources.GetMatch .Params.Image }}
{{ with .Fit "1000x1000" }}
<img itemprop="image" src="{{ .RelPermalink }}" {{ if .Params.imagecaption }}alt="{{.Params.imagecaption}}"{{ end }} style="max-width:75%"/>
{{ end }}
{{ end }}
{{ if .Params.imagecaption }}
<figcaption><p><b>Pictured:</b> {{ .Params.imagecaption }}</p></figcaption>
{{ end }}

View file

@ -5,14 +5,10 @@
<div class="sm-col sm-col-6 md-col-6 lg-col-4 xs-px1 xs-mb2">
<a class="block relative bg-blue" href="{{ .RelPermalink }}">
{{ if .Params.Image }}
<div class="image ratio bg-cover" style="background-image:url({{.Permalink}}{{ .Params.Image }});"></div>
{{ else }}
{{ with .Resources.ByType "image" }}
{{ range first 1 . }}
<div class="image ratio bg-cover" style="background-image:url({{ .Permalink }});"></div>
{{ with .Resources.GetMatch .Params.Image }}
{{ with .Fit "512x512" }}
<div class="image ratio bg-cover" style="background-image:url({{ .RelPermalink }});"></div>
{{ end }}
{{ else }}
<div class="image ratio bg-cover"></div>
{{ end }}
{{ end }}
<h1 class="title p2 m0 absolute white bottom-0 left-0 title-shadow">{{ .Title }}</h1>

View file

@ -164,7 +164,11 @@
{{ if .Params.image }}
<div class="xs-p2 center">
<figure itemprop="associatedMedia" itemscope itemtype="http://schema.org/ImageObject">
<img itemprop="image" src="{{ .Params.image }}" {{ if .Params.imagecaption }}alt="{{.Params.imagecaption}}"{{ end }} style="max-width:480px"/>
{{ with .Resources.GetMatch .Params.Image }}
{{ with .Fit "1000x1000" }}
<img itemprop="image" src="{{ .RelPermalink }}" {{ if .Params.imagecaption }}alt="{{.Params.imagecaption}}"{{ end }} style="max-width:75%"/>
{{ end }}
{{ end }}
{{ if .Params.imagecaption }}
<figcaption><p><b>Pictured:</b> {{ .Params.imagecaption }}</p></figcaption>
{{ end }}