diff options
| author | roninro <liumy.f@foxmail.com> | 2022-11-02 12:37:51 +0800 |
|---|---|---|
| committer | roninro <liumy.f@foxmail.com> | 2022-11-02 12:37:51 +0800 |
| commit | af2c2c3540d42b428d34094f5815db09ac8637b5 (patch) | |
| tree | 2aaf2ed7a62ee1f6dfb95b1592261480b6375457 | |
| parent | 46225bf4336fe6e46a7566248330e2d3ce21061f (diff) | |
Gravatar Support (#11)
| -rw-r--r-- | exampleSite/config.toml | 2 | ||||
| -rw-r--r-- | layouts/partials/short-about.html | 6 |
2 files changed, 6 insertions, 2 deletions
diff --git a/exampleSite/config.toml b/exampleSite/config.toml index 91746c1..8d2871d 100644 --- a/exampleSite/config.toml +++ b/exampleSite/config.toml @@ -82,6 +82,8 @@ custom_css = [] # ["css/custom.css"] Add your file to assets folder [assets/cs [params.sidebar] enable = true +gravatarEmail = "" +# Overwritten by your gravatar image if `gravatarEmail` is filled avatar = "img/home-bg.jpg" bio = "a personal website" diff --git a/layouts/partials/short-about.html b/layouts/partials/short-about.html index 4a1487d..cc0c477 100644 --- a/layouts/partials/short-about.html +++ b/layouts/partials/short-about.html @@ -9,7 +9,9 @@ {{ $sidebar := .Site.Params.sidebar }} <div class="short-about"> - {{ with $sidebar.avatar }} + {{ if $sidebar.gravatarEmail }} + <img src="https://s.gravatar.com/avatar/{{ md5 $sidebar.gravatarEmail }}?s=200" /> + {{ else if $sidebar.avatar }} <img src="{{ $sidebar.avatar | relURL }}" /> {{ end }} {{ with $sidebar.bio }} @@ -18,4 +20,4 @@ <!-- SNS Link --> {{ partial "sns-links.html" (dict "center" false "social" .Site.Params.social ) }} </div> -</section>
\ No newline at end of file +</section> |
