Skip to content

Commit

Permalink
Merge pull request #474 from spyrkob/add_avatars
Browse files Browse the repository at this point in the history
[#383] Add author picture to the blog post
  • Loading branch information
bstansberry authored Nov 9, 2023
2 parents a2208c5 + fd507be commit 36477f2
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 1 deletion.
29 changes: 28 additions & 1 deletion _layouts/post.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,37 @@
<div class="grid__item width-10-12">
<h1 class="title">{{page.title}}</h1>
{% assign author = "" | split: ',' %}
{% assign has_avatar = "false" %}
{% for a in page.author %}
{% assign author = author | push: site.data.authors[a].name %}
{% if site.data.authors[a].avatar != nil %}
{% assign has_avatar = "true" %}
{% endif %}
{% endfor %}
<p class="byline">By {{ author | join: ', ' }} | {{ page.date | date: '%B %d, %Y' }}</p>

<p>
{% if has_avatar == "true" %}
{% for a in page.author %}
{% assign author_data = site.data.authors[a] %}
<p class="byline">
{% if author_data.avatar != %}
<img class="avatar" height="60px" width="60px" src="/assets/img/authors/{{author_data.avatar}}"/>
{% else %}
<img class="avatar" height="60px" width="60px" src="/assets/img/contribute/wildfly_icons_contribute-blog.png"/>
{% endif %}

{% if a == page.author.first or page.author.first == nil %}By {% endif %}{{author_data.name}}
{% if a != page.author[-1] and page.author.first != nil %}
,
{% else %}
| {{ page.date | date: '%B %d, %Y' }}
{% endif %}
</p>
{% endfor %}
{% else %}
<p class="byline">By {{ author | join: ', ' }} | {{ page.date | date: '%B %d, %Y' }}</p>
{% endif %}
</p>
</div>
<div class="grid__item width-10-12 doc-content">
{{ content }}
Expand Down
5 changes: 5 additions & 0 deletions _sass/global.scss
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,11 @@ p.byline {
line-height: 1.8rem;
}

img.avatar {
vertical-align:middle;
border-radius: 50%;
}

a {
line-height: 1.5rem;
font-weight: 400;
Expand Down

0 comments on commit 36477f2

Please sign in to comment.