1
0
Fork 0

add gravatar cdn support

This commit is contained in:
nanxiaobei 2022-12-27 02:48:49 +08:00
parent 40b26fcd68
commit 18abfa9daf

View file

@ -23,9 +23,11 @@
{{ if in site.Params.avatar "http" }}<!---->
{{ $.Scratch.Set "avatar_url" site.Params.avatar }}<!---->
{{ else }}<!---->
{{ $official_cdn := "https://www.gravatar.com/avatar/" }}<!---->
{{ $cdn := (site.Params.gravatarCdn | default $official_cdn) }}<!---->
{{ $md5 := (md5 site.Params.avatar) }}<!---->
{{ $url := print "https://www.gravatar.com/avatar/" $md5 "?s=160&d=identicon" }}<!---->
{{ $.Scratch.Set "avatar_url" $url }}<!---->
{{ $avatar_url := print $cdn $md5 "?s=160&d=identicon" }}<!---->
{{ $.Scratch.Set "avatar_url" $avatar_url }}<!---->
{{ end }}<!---->
{{ end }}<!---->