This commit is contained in:
Emruz Hossain 2021-01-01 02:36:53 +06:00
parent 7317ba53de
commit 8184658c19
14 changed files with 61 additions and 43 deletions

View file

@ -2,11 +2,14 @@
{{ if (index site.Data site.Language.Lang).author }}
{{ $author = (index site.Data site.Language.Lang).author }}
{{ end }}
{{/* default author image */}}
{{ $authorImage:= "/images/default-avatar.png" }}
{{ if $author.image }}
{{ $authorImage = $author.image }}
{{ end }}
{{/* if author image is provided in author's data, then use that */}}
{{ if eq (printf "%T" .Params.author ) "maps.Params" }}
{{ with .Params.author }}
{{ if .image }}
@ -14,9 +17,13 @@
{{ end }}
{{ end }}
{{ end }}
{{/* apply image processing. don't use "Fit" in svg because its not supported */}}
{{ $authorImage:= resources.Get $authorImage}}
{{ if $authorImage }}
{{ $authorImage := $authorImage.Fit "120x120" }}
{{ return $authorImage.RelPermalink }}
{{ if and $authorImage (ne $authorImage.MediaType.SubType "svg") }}
{{ $authorImage := $authorImage.Fit "120x120" }}
{{ end }}
{{/* return the author image link */}}
{{ return $authorImage.RelPermalink }}