Skip to content

Commit

Permalink
Merge pull request #56 from tarasmatsyk/add_gravatar_support
Browse files Browse the repository at this point in the history
Add gravatar support
  • Loading branch information
htr3n authored Nov 23, 2018
2 parents d3780e0 + a02e364 commit 5ed13e1
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions layouts/partials/sidebar.html
Original file line number Diff line number Diff line change
Expand Up @@ -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}}
Expand Down

0 comments on commit 5ed13e1

Please sign in to comment.