Skip to content

Commit 0618636

Browse files
author
~hacker
authored
Add support for GitHub avatars to replace Gravatar (#36)
1 parent ec66323 commit 0618636

File tree

3 files changed

+20
-3
lines changed

3 files changed

+20
-3
lines changed

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,10 @@ dash:
6969
color: purple
7070

7171
show_author: true
72+
73+
# Replaces the default avatar provider (gravatar)
74+
#avatar_source: github
75+
#github_username: bitbrain
7276
```
7377
## Using this theme directly on Github Pages
7478

_config.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,3 +46,7 @@ plugins:
4646
- jekyll-paginate
4747
- liquid-md5
4848
- jekyll/tagging
49+
50+
# Replaces the default avatar provider (gravatar)
51+
#avatar_source: github
52+
#github_username: bitbrain

_includes/author.html

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,15 @@
11
<div class="author-box">
2-
{% if site.plugins contains "liquid-md5" %}
3-
<img src="https://gravatar.com/avatar/{{ site.email | downcase | md5 }}?s=256" class="author-avatar" />
4-
{% endif %}
2+
{% if site.avatar_source == "github" and site.github_username %}
3+
{% capture avatar_image %}
4+
https://github.com/{{ site.github_username }}.png
5+
{% endcapture %}
6+
{% elsif site.plugins contains "liquid-md5" %}
7+
{% capture avatar_image %}
8+
https://gravatar.com/avatar/{{ site.email | downcase | md5 }}?s=256
9+
{% endcapture %}
10+
{% endif %}
11+
{% if avatar_image %}
12+
<img src="{{ avatar_image }}" class="author-avatar" alt="Avatar" />
13+
{% endif %}
514
{{ site.description }}
615
</div>

0 commit comments

Comments
 (0)