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 */}}
|
||||
|
||||
{{ $tinyw := default "500x" }}
|
||||
{{ $smallw := default "800x" }}
|
||||
{{ $mediumw := default "1200x" }}
|
||||
{{ $largew := default "1500x" }}
|
||||
{{ $tinyw := default "408x" }}
|
||||
{{ $smallw := default "816x" }}
|
||||
{{ $mediumw := default "1224x" }}
|
||||
{{ $largew := default "1632x" }}
|
||||
|
||||
{{/* resize the src image to the given sizes */}}
|
||||
|
||||
@ -28,17 +28,17 @@
|
||||
<img
|
||||
{{ with .Get "sizes" }}sizes='{{.}}'{{ else }}sizes="(min-width: 35em) 1200px, 100vw"{{ end }}
|
||||
srcset='
|
||||
{{ if ge $src.Width "500" }}
|
||||
{{ with $tiny.RelPermalink }}{{.}} 500w{{ end }}
|
||||
{{ if ge $src.Width "408" }}
|
||||
{{ with $tiny.RelPermalink }}{{.}} 408w{{ end }}
|
||||
{{ end }}
|
||||
{{ if ge $src.Width "800" }}
|
||||
{{ with $small.RelPermalink }}, {{.}} 800w{{ end }}
|
||||
{{ if ge $src.Width "816" }}
|
||||
{{ with $small.RelPermalink }}, {{.}} 816w{{ end }}
|
||||
{{ end }}
|
||||
{{ if ge $src.Width "1200" }}
|
||||
{{ with $medium.RelPermalink }}, {{.}} 1200w{{ end }}
|
||||
{{ if ge $src.Width "1224" }}
|
||||
{{ with $medium.RelPermalink }}, {{.}} 1224w{{ end }}
|
||||
{{ end }}
|
||||
{{ if ge $src.Width "1500" }}
|
||||
{{ with $large.RelPermalink }}, {{.}} 1500w {{ end }}
|
||||
{{ if ge $src.Width "1632" }}
|
||||
{{ with $large.RelPermalink }}, {{.}} 1632w {{ end }}
|
||||
{{ end }}'
|
||||
{{ if .Get $medium }}
|
||||
src="{{ $medium.RelPermalink }}"
|
||||
|
||||
Loading…
Reference in New Issue
Block a user