hugo-toha/layouts/partials/helpers/get-author-image.html
Patrick Magauran 49cb1042ea Update layout to use Hugo Image Processing.
Created shortcode rimg that uses the srcset attribute to display responsive images.
2021-01-01 02:49:21 +06:00

22 lines
646 B
HTML

{{ $author:= site.Data.author }}
{{ if (index site.Data site.Language.Lang).author }}
{{ $author = (index site.Data site.Language.Lang).author }}
{{ end }}
{{ $authorImage:= "/assets/images/default-avatar.png" }}
{{ if $author.image }}
{{ $authorImage = $author.image }}
{{ end }}
{{ if eq (printf "%T" .Params.author ) "maps.Params" }}
{{ with .Params.author }}
{{ if .image }}
{{ $authorImage = .image }}
{{ end }}
{{ end }}
{{ end }}
{{ $authorImage:= resources.Get $authorImage}}
{{ if $authorImage }}
{{ $authorImage := $authorImage.Fit "120x120" }}
{{ return $authorImage.RelPermalink }}
{{ end }}