{{- /* Get author in map format. @param {String|Map} . the author name or map @returns {Map} @example {{- $author := partial "function/get-author-map.html" .Params.author -}} */ -}} {{- if not (reflect.IsMap site.Params.author) -}} {{- errorf "FixIt params error: site.Params.author must be a map, got %T." site.Params.author -}} {{- end -}} {{- $default := dict "name" "" "link" "" "email" "" "avatar" "" -}} {{- $author := site.Params.author | merge $default -}} {{- $authorParam := dict -}} {{- if reflect.IsMap . -}} {{- $authorParam = . -}} {{- else -}} {{- with . -}} {{- $authorParam = dict "name" . -}} {{- end -}} {{- end -}} {{- if isset $authorParam "name" | and (ne $authorParam.name site.Params.author.name) -}} {{- $author = $authorParam | merge $default | merge $author -}} {{- else -}} {{- with $authorParam.link -}}{{ $author = dict "link" . | merge $author }}{{- end -}} {{- with $authorParam.email -}}{{ $author = dict "email" . | merge $author }}{{- end -}} {{- with $authorParam.avatar -}}{{ $author = dict "avatar" . | merge $author }}{{- end -}} {{- end -}} {{- $gravatar := dict "Email" $author.email "Size" "32" | partial "function/get-gravatar.html" -}} {{- with $gravatar -}} {{- $author = dict "avatar" . | merge $author -}} {{- end -}} {{- return $author -}}