Files
HugoBlox-kit/wowchemy/layouts/partials/functions/get_logo.html
T
George Cushen 1d58e5e819 feat: rename assets/images/ to assets/media/ and auto detect sharing image
The file uploader in Wowchemy CMS has also been updated to reflect the change.

BREAKING CHANGES:
- rename assets/images/ to assets/media/
- move default social sharing image (if any) to assets/media/sharing.*
2021-02-20 17:28:11 +00:00

22 lines
978 B
HTML

{{/* Function to get logo image. */}}
{{/* Inputs: constraint: max_height/fit (str); size (int) */}}
{{/* Output: resource (obj) */}}
{{/* Workaround fact Hugo does not support GetMatch in assets dir */}}
{{/* Hugo doesn't support image ops on SVG: https://discourse.gohugo.io/t/ho-do-i-convert-a-generic-resource-to-image-resource/22570/4 */}}
{{ $logo := resources.Get "media/logo.png" | default (resources.Get "media/logo.svg") }}
{{ $logo_proc := $logo }}
{{/* If the type of image can be resized by Hugo, resize it given a `.size` argument to the function. */}}
{{ if resources.Get "media/logo.png" }}
{{ if eq .constraint "max_height" }}
{{/* Resize logo to fit specified max height. */}}
{{ $logo_proc = ($logo.Resize (printf "x%s" (string .size))) }}
{{ else }}
{{/* Constrain logo to fit within specified dimensions. */}}
{{ $logo_proc = ($logo.Fit (printf "%sx%s" (string .size) (string .size))) }}
{{ end }}
{{ end }}
{{ return $logo_proc }}