Skip to content

Commit 5333f53

Browse files
committed
increasing image quality
1 parent 5c52ee1 commit 5333f53

1 file changed

Lines changed: 2 additions & 30 deletions

File tree

layouts/shortcodes/img.html

Lines changed: 2 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,9 @@
11
{{- $src := .Page.Resources.GetMatch (.Get "src") -}}
22
{{- if $src -}}
3-
4-
{{ $tinyw := default "500x" }}
5-
{{ $smallw := default "800x" }}
6-
{{ $mediumw := default "1200x" }}
7-
{{ $largew := default "1500x" }}
8-
9-
{{ .Scratch.Set "tiny" ($src.Resize $tinyw) }}
10-
{{ .Scratch.Set "small" ($src.Resize $smallw) }}
11-
{{ .Scratch.Set "medium" ($src.Resize $mediumw) }}
12-
{{ .Scratch.Set "large" ($src.Resize $largew) }}
13-
14-
15-
{{ $tiny := .Scratch.Get "tiny" }}
16-
{{ $small := .Scratch.Get "small" }}
17-
{{ $medium := .Scratch.Get "medium" }}
18-
{{ $large := .Scratch.Get "large" }}
193
<div class="imageWrapper">
204
<img
21-
{{ with .Get "sizes" }}sizes='{{.}}'{{ else }}sizes="(min-width: 35em) 600px, 100vw"{{ end }}
22-
srcset='
23-
{{ if ge $src.Width "500" }}
24-
{{ with $tiny.RelPermalink }}{{.}} 500w{{ end }}
25-
{{ end }}
26-
{{ if ge $src.Width "800" }}
27-
{{ with $small.RelPermalink }}, {{.}} 800w{{ end }}
28-
{{ end }}'
29-
{{ if .Get (print $medium) }}
30-
src="{{ $medium.RelPermalink }}"
31-
width = "100%"
32-
{{ else }}
33-
src="{{ $src.RelPermalink }}"
34-
{{ end }}
5+
src="{{ $src.RelPermalink }}"
6+
width = "100%"
357
/>
368
</div>
379

0 commit comments

Comments
 (0)