mirror of
https://gitlab.com/ansol/web-ansol.org.git
synced 2024-12-27 06:10:19 +00:00
22 lines
981 B
HTML
22 lines
981 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 "images/logo.png" | default (resources.Get "images/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 "images/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 }}
|