jekyll / jekyll-avatar

A Jekyll plugin for rendering GitHub avatars
MIT License
89 stars 9 forks source link

Error with avatars in for loops/variable-defined usernames #37

Closed RDIL closed 4 years ago

RDIL commented 5 years ago

Describe the bug

Hi! I just started a site on github pages with jekyll and this plugin.

(page is located at https://cakebot.club/contributors.html )

It seems that in production, all the rendered avatars are the first avatar in the data set, not the defined ones

Steps to reproduce the behavior

  1. Go to the link above
  2. See error

Expected behavior

The avatars should match the data given, not just mine. @121jwang and @paramt 's avatars should be visible next to their names

Additional context

My markdown:

---
title: Contributors
layout: default
---

## Contributors

Cakebot would not be possible without the help, time, and dedication of the following people:

{% for contributor in site.data.contributors %}
  * {% avatar {{ contributor.github }} size=50 %} {{ contributor.name }} - @{{ contributor.github }}
{% endfor %}

data file (csv):

name,github
jumbo,RDIL
Tarsh,121jwang
Param,paramt

Thank you!

ajitzero commented 5 years ago

I'm facing the same issue. I'm using this with:

{% for post in paginator.posts %}
  {% include post_preview.html %}
{% endfor %}

In post_preview.html, I've got:

{% avatar {{ author.social.github }} %}

which doesn't work, but this works:

{% avatar benbalter %}

So apparently, it takes only the first name's photo when used within a loop, but any fixed username call within the loop works just fine.

RDIL commented 5 years ago

@benbalter please take a look at this when you can :)

benbalter commented 5 years ago

Have you tried the user= format as described in https://github.com/benbalter/jekyll-avatar#passing-the-username-as-variable?

GitHub
benbalter/jekyll-avatar
A Jekyll plugin for rendering GitHub avatars. Contribute to benbalter/jekyll-avatar development by creating an account on GitHub.
RDIL commented 5 years ago

I’ll give it a shot. Thanks.

RDIL commented 5 years ago

Sadly, it didn’t work :(

GitHub
benbalter/jekyll-avatar
A Jekyll plugin for rendering GitHub avatars. Contribute to benbalter/jekyll-avatar development by creating an account on GitHub.
RDIL commented 4 years ago

Interesting, not sure what I did but it looks to be fixed now.

stale[bot] commented 4 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

kusma commented 2 years ago

I'm seeing the same issue here. It seems to trigger when I use {% avatar {{ foo }} %} in a layout file, but not if I do it in an article. It's almost as if a variable gets cached from some previously rendered page or something like that.

kusma commented 2 years ago

Here's a reproduction case: https://github.com/kusma/jekyll-avatar-issue-37-repro

Render the reproduction, and observe that bar.html renders correctly, but foo.html gets the avatar from bar.html instead of the right one. I think that supports the caching hypothesis.

ashmaroli commented 2 years ago

@kusma Were you able to reproduce this issue with Jekyll 3.9?

kusma commented 2 years ago

Just tried, and no, it does not reproduce with Jekyll 3.9. So I guess there's some change in behavior in Jekyll 4.x that breaks this...

kusma commented 2 years ago

Since this seems unrelated to what the other users have experienced (Jekyll 4.x wasn't our in 2019), I decided to create a new ticked. So please ignore this ;)