From e613e3ba00469dfb92a914ee0b0a4e489b1489cf Mon Sep 17 00:00:00 2001 From: Ka-Wai Lin Date: Mon, 2 Mar 2020 18:54:33 +0100 Subject: [PATCH] Adding gravatar support (#268) * Gravatar support Adding gravatar as alternative avatar * Update CONTRIBUTORS.md --- CONTRIBUTORS.md | 1 + exampleSite/config.toml | 1 + layouts/partials/home.html | 9 +++++++-- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index d57bfe2..8cfe97d 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -58,3 +58,4 @@ - [FIGBERT](https://figbert.com/) - [Yash Mehrotra](https://yashmehrotra.com) - [Paolo Mainardi](https://paolomainardi.com) +- [Ka-Wai Lin](https://github.com/kwlin) \ No newline at end of file diff --git a/exampleSite/config.toml b/exampleSite/config.toml index 3f02c74..823c28a 100644 --- a/exampleSite/config.toml +++ b/exampleSite/config.toml @@ -21,6 +21,7 @@ disqusShortname = "yourdiscussshortname" keywords = "blog,developer,personal" info = "Full Stack DevOps and Magician" avatarurl = "images/avatar.jpg" + #gravatar = "john.doe@example.com" footercontent = "Enter a text here." dateformat = "January 2, 2006" diff --git a/layouts/partials/home.html b/layouts/partials/home.html index 1c17468..a911ec8 100644 --- a/layouts/partials/home.html +++ b/layouts/partials/home.html @@ -1,7 +1,12 @@
- {{ with .Site.Params.avatarurl }} -
avatar
+ {{ if and (isset .Site.Params "avatarurl") (not (isset .Site.Params "gravatar")) }} + {{ with .Site.Params.avatarurl }} +
avatar
+ {{ end }} + {{ end }} + {{ with .Site.Params.gravatar }} +
gravatar
{{ end }}

{{ .Site.Params.author }}

{{ .Site.Params.info }}