Skip to content

Commit 5ed13e1

Browse files
authored
Merge pull request #56 from tarasmatsyk/add_gravatar_support
Add gravatar support
2 parents d3780e0 + a02e364 commit 5ed13e1

File tree

1 file changed

+13
-6
lines changed

1 file changed

+13
-6
lines changed

‎layouts/partials/sidebar.html

+13-6
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,19 @@
55
<span class="site__title">
66
<a href="{{ .Site.BaseURL }}">{{ .Site.Title }}</a>
77
</span>
8-
{{ with .Site.Params.authorimage }}
9-
{{ $strippedSlash := ($.Site.Params.authorimage | replaceRE "^(/)+(.*)" "$2") }}
10-
{{ $authorImage := (printf "%s/%s" $.Site.BaseURL $strippedSlash) }}
11-
<div class="author-image">
12-
<img src="{{$authorImage}}" alt="Author Image" class="img--circle img--headshot element--center">
13-
</div>
8+
{{ if and (isset .Site.Params "authorimage") (not (isset .Site.Params.social "gravatar")) }}
9+
{{ with .Site.Params.authorimage }}
10+
{{ $strippedSlash := ($.Site.Params.authorimage | replaceRE "^(/)+(.*)" "$2") }}
11+
{{ $authorImage := (printf "%s/%s" $.Site.BaseURL $strippedSlash) }}
12+
<div class="author-image">
13+
<img src="{{$authorImage}}" alt="Author Image" class="img--circle img--headshot element--center">
14+
</div>
15+
{{ end }}
16+
{{ end }}
17+
{{ with .Site.Params.social.gravatar}}
18+
<div class="author-image">
19+
<img src="https://www.gravatar.com/avatar/{{md5 .}}?s=240&d=mp" class="img--circle img--headshot element--center" alt="gravatar">
20+
</div>
1421
{{ end }}
1522
<p class="site__description">
1623
{{ with .Site.Params.description }} {{.}} {{end}}

0 commit comments

Comments
 (0)