Skip to content

Commit

Permalink
Feature: Adding linkback functionality Author avatar & Name (mmistake…
Browse files Browse the repository at this point in the history
…s#1386)

* adding linkback funct to author avatar & nm

* rm author_class; change linkback var to home; updating config docs
  • Loading branch information
shredtechular authored and mmistakes committed Dec 11, 2017
1 parent f9caea4 commit 59b3252
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 3 deletions.
23 changes: 20 additions & 3 deletions _includes/author-profile.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,32 @@
{% if author.avatar %}
<div class="author__avatar">
{% if author.avatar contains "://" %}
<img src="{{ author.avatar }}" alt="{{ author.name }}" itemprop="image">
{% assign author_src = author.avatar %}
{% else %}
<img src="{{ author.avatar | absolute_url }}" class="author__avatar" alt="{{ author.name }}" itemprop="image">
{% assign author_src = author.avatar | absolute_url %}
{% endif %}

{% if author.home %}
{% if author.home contains "://" %}
{% assign author_link = author.home %}
{% else %}
{% assign author_link = author.home | absolute_url %}
{% endif %}
<a href="{{ author_link }}">
<img src="{{ author_src }}" alt="{{ author.name }}" itemprop="image">
</a>
{% else %}
<img src="{{ author_src }}" alt="{{ author.name }}" itemprop="image">
{% endif %}
</div>
{% endif %}

<div class="author__content">
<h3 class="author__name" itemprop="name">{{ author.name }}</h3>
{% if author.home %}
<a href="{{ author_link }}"><h3 class="author__name" itemprop="name">{{ author.name }}</h3></a>
{% else %}
<h3 class="author__name" itemprop="name">{{ author.name }}</h3>
{% endif %}
{% if author.bio %}
<p class="author__bio" itemprop="description">
{{ author.bio }}
Expand Down
5 changes: 5 additions & 0 deletions _sass/minimal-mistakes/_sidebar.scss
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,11 @@
padding-left: 0;
padding-right: 0;
}

a {
color: inherit;
text-decoration: none;
}
}

.author__name {
Expand Down
1 change: 1 addition & 0 deletions docs/_docs/05-configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -646,6 +646,7 @@ author:
bio : "My awesome biography constrained to a sentence or two goes here."
email : # optional
uri : "http://your-site.com"
home : # null (default), "absolute or relative url to link to author home"
```

Social media links are all optional, include the ones you want visible. In most cases you just need to add the username. If you're unsure double check `_includes/author-profile.html` to see how the URL is constructed.
Expand Down

0 comments on commit 59b3252

Please sign in to comment.