diff --git a/layouts/partials/index_profile.html b/layouts/partials/index_profile.html
index 6882f39b..b1430574 100644
--- a/layouts/partials/index_profile.html
+++ b/layouts/partials/index_profile.html
@@ -13,7 +13,7 @@
{{- end -}}
{{- $prod := (hugo.IsProduction | or (eq site.Params.env "production")) }}
{{- if and (in $processableFormats $img.MediaType.SubType) (eq $prod true)}}
- {{- if (not (and (not .imageHeight) (not .imageWidth))) }}
+ {{- if and .imageWidth .imageHeight }}
{{- $img = $img.Resize (printf "%dx%d" .imageWidth .imageHeight) }}
{{- else if .imageHeight }}
{{- $img = $img.Resize (printf "x%d" .imageHeight) }}