mirror of
https://github.com/danbee/danbarber.me.hugo.git
synced 2025-03-04 08:59:18 +00:00
Better image sizes
This commit is contained in:
parent
9104e88286
commit
213148524f
@ -3,10 +3,10 @@
|
|||||||
|
|
||||||
{{/* set image sizes, these are hardcoded for now, x dictates that images are resized to this width */}}
|
{{/* set image sizes, these are hardcoded for now, x dictates that images are resized to this width */}}
|
||||||
|
|
||||||
{{ $tinyw := default "500x" }}
|
{{ $tinyw := default "408x" }}
|
||||||
{{ $smallw := default "800x" }}
|
{{ $smallw := default "816x" }}
|
||||||
{{ $mediumw := default "1200x" }}
|
{{ $mediumw := default "1224x" }}
|
||||||
{{ $largew := default "1500x" }}
|
{{ $largew := default "1632x" }}
|
||||||
|
|
||||||
{{/* resize the src image to the given sizes */}}
|
{{/* resize the src image to the given sizes */}}
|
||||||
|
|
||||||
@ -28,17 +28,17 @@
|
|||||||
<img
|
<img
|
||||||
{{ with .Get "sizes" }}sizes='{{.}}'{{ else }}sizes="(min-width: 35em) 1200px, 100vw"{{ end }}
|
{{ with .Get "sizes" }}sizes='{{.}}'{{ else }}sizes="(min-width: 35em) 1200px, 100vw"{{ end }}
|
||||||
srcset='
|
srcset='
|
||||||
{{ if ge $src.Width "500" }}
|
{{ if ge $src.Width "408" }}
|
||||||
{{ with $tiny.RelPermalink }}{{.}} 500w{{ end }}
|
{{ with $tiny.RelPermalink }}{{.}} 408w{{ end }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
{{ if ge $src.Width "800" }}
|
{{ if ge $src.Width "816" }}
|
||||||
{{ with $small.RelPermalink }}, {{.}} 800w{{ end }}
|
{{ with $small.RelPermalink }}, {{.}} 816w{{ end }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
{{ if ge $src.Width "1200" }}
|
{{ if ge $src.Width "1224" }}
|
||||||
{{ with $medium.RelPermalink }}, {{.}} 1200w{{ end }}
|
{{ with $medium.RelPermalink }}, {{.}} 1224w{{ end }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
{{ if ge $src.Width "1500" }}
|
{{ if ge $src.Width "1632" }}
|
||||||
{{ with $large.RelPermalink }}, {{.}} 1500w {{ end }}
|
{{ with $large.RelPermalink }}, {{.}} 1632w {{ end }}
|
||||||
{{ end }}'
|
{{ end }}'
|
||||||
{{ if .Get $medium }}
|
{{ if .Get $medium }}
|
||||||
src="{{ $medium.RelPermalink }}"
|
src="{{ $medium.RelPermalink }}"
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user