diff --git a/layouts/partials/assets/helpers/GetDimension.html b/layouts/partials/assets/helpers/GetDimension.html index 0c3644b1..24529913 100644 --- a/layouts/partials/assets/helpers/GetDimension.html +++ b/layouts/partials/assets/helpers/GetDimension.html @@ -3,11 +3,23 @@ --> {{ $ratio := .ratio }} - {{ $dim := "" }} -{{ $matches := first 1 (where site.Data.dimensions "ratio" $ratio) }} -{{ if eq ($matches | len) 1 }} - {{ $dim = (index $matches 0).dimensions }} +{{ $default := dict "4x3" "1400x1050" "3x2" "1400x933" "1x1" "1400x1400" "16x9" "1400x788" "21x9" "1400x600" "auto" "1400" }} + + +{{ $config := "dimensions" }} +{{ with index site.Params "dam" }}{{ with index . "dimensions" }}{{ $config = . }}{{ end }}{{ end }} +{{ $config = path.Join (path.Dir $config) (path.BaseName $config) }} + +{{ with index site.Data $config }} + {{ $matches := first 1 (where . "ratio" $ratio) }} + {{ if eq ($matches | len) 1 }} + {{ $dim = (index $matches 0).dimensions }} + {{ end }} +{{ end }} + +{{ if not $dim }} + {{ $dim = slice (index $default $ratio) }} {{ end }} {{ return $dim }}