From 18abfa9dafcb635499d3e7de4e39e30a1abe45c1 Mon Sep 17 00:00:00 2001 From: nanxiaobei Date: Tue, 27 Dec 2022 02:48:49 +0800 Subject: [PATCH] add gravatar cdn support --- layouts/_default/baseof.html | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/layouts/_default/baseof.html b/layouts/_default/baseof.html index 7b41d5f..bb6fbd4 100644 --- a/layouts/_default/baseof.html +++ b/layouts/_default/baseof.html @@ -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 }}