Skip to content

Commit f5138cf

Browse files
authored
update layout
1 parent e935031 commit f5138cf

File tree

3 files changed

+11
-164
lines changed

3 files changed

+11
-164
lines changed

.github/workflows/gh-pages.yml

Lines changed: 0 additions & 63 deletions
This file was deleted.

.github/workflows/ipfs.yml

Lines changed: 0 additions & 96 deletions
This file was deleted.

layouts/_default/_markup/render-image.html

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,17 +17,23 @@
1717
{{- if and hugo.IsExtended (ne $src.MediaType.Type "image/webp") -}}
1818
{{- $imageTypes = $imageTypes | append "webp" -}}
1919
{{- end -}}
20-
{{- $imageTypes = $imageTypes | append $src.MediaType.SubType -}}
2120
{{- if gt (index $respSizes 0) $src.Width -}}
2221
{{- $respSizes = slice $src.Width -}}
2322
{{- end -}}
2423
<picture>
2524
{{- range $imageType := $imageTypes -}}
2625
<source type="image/{{ $imageType }}" srcset="
27-
{{- with $respSizes -}}
28-
{{- range $i, $e := . -}}
29-
{{- if ge $src.Width . -}}
30-
{{- if $i }}, {{ end -}}{{- ($src.Resize (print . "x " $imageType " " $filter) ).RelPermalink | absURL}} {{ . }}w
26+
{{- compressedImage := printf "%s_1080x.%s" .Destination $imageType -}}
27+
{{- $cmSrc := .Page.Resources.GetMatch $compressedImage -}}
28+
{{- if $cmSrc -}}
29+
{{ $cmSrc.RelPermalink | absURL}} 1080w
30+
{{- else -}}
31+
{{- $imageTypes = $imageTypes | append $src.MediaType.SubType -}}
32+
{{- with $respSizes -}}
33+
{{- range $i, $e := . -}}
34+
{{- if ge $src.Width . -}}
35+
{{- if $i }}, {{ end -}}{{- ($src.Resize (print . "x " $imageType " " $filter) ).RelPermalink | absURL}} {{ . }}w
36+
{{- end -}}
3137
{{- end -}}
3238
{{- end -}}
3339
{{- end -}}" sizes="{{ $dataSizes }}" />

0 commit comments

Comments
 (0)