1

please how can I show the author personal image if I have id defined in collections:

My collection /_authors/

name: John Doe
image: assets/img/photo-john.jpg
layout: author
permalink: "/authors/john-doe/"

How do I show it in the article loop?

{% for post in site.posts %}
    {% assign author = site.authors[page.author] %}
    <img src="{{ site.baseurl }}/{{ author.image }}" alt="{{ post.author }}" class="avatar avatar-sm">
{% endfor %}
KargWare
  • 1,746
  • 3
  • 22
  • 35
Richard Kacerek
  • 137
  • 1
  • 1
  • 7

1 Answers1

0

What about {{ author.image }} and relative_url?

I assume image is the url to the image.

In markdown

{% for post in site.posts %} 
{% assign author = site.authors[page.author] %} 

{: .avatar .avatar-sm }
![{{ post.author }}]({{ author.image | relative_url }})

{% endfor %}

In html


{% for post in site.posts %} 
{% assign author = site.authors[page.author] %} 

<img src="{{ author.image | relative_url }}" alt="{{ post.author }}" class="avatar avatar-sm">

{% endfor %}
KargWare
  • 1,746
  • 3
  • 22
  • 35