mirror of
https://github.com/hugo-fixit/FixIt.git
synced 2026-08-24 15:28:57 +00:00
24 lines
699 B
HTML
24 lines
699 B
HTML
{{- /*
|
|
Get Gravatar URL.
|
|
@param {String} Email the email address
|
|
@param {String} Size the size in pixels (optional, default: 200)
|
|
@returns {String} the Gravatar URL
|
|
@example {{- $gravatar := dict "Email" "user@example.com" "Size" "32" | partial "function/get-gravatar.html" -}}
|
|
*/ -}}
|
|
|
|
{{- $config := site.Params.gravatar -}}
|
|
{{- $gravatar := "" -}}
|
|
{{- if $config.enable | and .Email -}}
|
|
{{- with $config -}}
|
|
{{- $gravatar =
|
|
printf "https://%v/avatar/%v?s=%v&d=%v"
|
|
(path.Clean ($.Host | default .Host) | default "www.gravatar.com")
|
|
(md5 $.Email)
|
|
($.Size | default 200)
|
|
(.Style | default "")
|
|
-}}
|
|
{{- end -}}
|
|
{{- end -}}
|
|
|
|
{{- return $gravatar -}}
|