diff options
author | Austin Gebauer <agebauer@hashicorp.com> | 2020-04-05 06:42:40 +0300 |
---|---|---|
committer | Austin Gebauer <agebauer@hashicorp.com> | 2020-04-05 06:42:40 +0300 |
commit | 254232f5ab21291eb1e0fe655ab26e681f09411d (patch) | |
tree | a7a99c05924e3a342e9ad1c0b636bf7d5075e461 | |
parent | 9876e9e37ae3378a54a2f62e5eb521653f73714e (diff) |
fix: append / prefix to image if not exists
-rw-r--r-- | layouts/partials/header.html | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/layouts/partials/header.html b/layouts/partials/header.html index 0c72c6c..de8a0a7 100644 --- a/layouts/partials/header.html +++ b/layouts/partials/header.html @@ -4,7 +4,11 @@ <a href="/" class="text-decoration-none"> <img id="home-image" class="rounded-circle" {{ if (fileExists (printf "static/%s" (strings.TrimPrefix "/" .Site.Params.home_image))) }} - src="{{ .Site.Params.home_image }}" + {{ if hasPrefix .Site.Params.home_image "/" }} + src="{{ .Site.Params.home_image }}" + {{ else }} + src="{{ printf "/%s" .Site.Params.home_image }}" + {{ end }} {{ else }} src="https://cdn.clipart.email/83451492858686fbb12fdf8df0957c94_lil-silhouettes-by-lil-squid_481-512.png" {{ end }} |