diff options
author | Huy Tran <hoang.huy.tran@gmail.com> | 2018-11-24 02:00:31 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-11-24 02:00:31 +0300 |
commit | 5ed13e17400bbc09a342b60fd50cd9fe3e6f1525 (patch) | |
tree | 38dc8b345030cca00b6e325f5bc864451557641e | |
parent | d3780e0a4746fecca7b9988efb0214c7b58b26bd (diff) | |
parent | a02e3640c922befdcfdb82158557ca160a1fbdb8 (diff) |
Merge pull request #56 from tarasmatsyk/add_gravatar_support
Add gravatar support
-rw-r--r-- | layouts/partials/sidebar.html | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/layouts/partials/sidebar.html b/layouts/partials/sidebar.html index 8c03b9b..c712005 100644 --- a/layouts/partials/sidebar.html +++ b/layouts/partials/sidebar.html @@ -5,12 +5,19 @@ <span class="site__title"> <a href="{{ .Site.BaseURL }}">{{ .Site.Title }}</a> </span> - {{ with .Site.Params.authorimage }} - {{ $strippedSlash := ($.Site.Params.authorimage | replaceRE "^(/)+(.*)" "$2") }} - {{ $authorImage := (printf "%s/%s" $.Site.BaseURL $strippedSlash) }} - <div class="author-image"> - <img src="{{$authorImage}}" alt="Author Image" class="img--circle img--headshot element--center"> - </div> + {{ if and (isset .Site.Params "authorimage") (not (isset .Site.Params.social "gravatar")) }} + {{ with .Site.Params.authorimage }} + {{ $strippedSlash := ($.Site.Params.authorimage | replaceRE "^(/)+(.*)" "$2") }} + {{ $authorImage := (printf "%s/%s" $.Site.BaseURL $strippedSlash) }} + <div class="author-image"> + <img src="{{$authorImage}}" alt="Author Image" class="img--circle img--headshot element--center"> + </div> + {{ end }} + {{ end }} + {{ with .Site.Params.social.gravatar}} + <div class="author-image"> + <img src="https://www.gravatar.com/avatar/{{md5 .}}?s=240&d=mp" class="img--circle img--headshot element--center" alt="gravatar"> + </div> {{ end }} <p class="site__description"> {{ with .Site.Params.description }} {{.}} {{end}} |