Open tblobaum opened 2 years ago
@tblobaum see https://github.com/jekyll/jekyll-avatar#passing-the-username-as-variable for alternate ways to pass "complex" variables.
@benbalter that's the part of the documentation I originally referenced. Unless I'm too dumb to figure it out it doesn't quite work.
@tblobaum Is your repository public? If yes, please provide the link to it and the URL of your webpage where you see the issue. Thanks.
The repository is public but I have since changed the code.
First of all, your example doesn't make sense.
{% assign user="hubot" %}
{% avatar {{ username }} %}
Why are you assigning user
and then using username
?
Secondly, I have narrowed down the issue. It seems that if I set author: tblobaum
in the front matter and then try to use {% avatar {{ page.author }} %}
it fails and loads the name from the GitHub account as a username to fetch the avatar with. For instance when page.author
is tblobaum
it tries to load an avatar for Thomas
. I found out I can get avatars to work by only using them in an array. For some reason unknown to me, when placed in a loop of all site.authors
the same code {% avatar {{ page.author }} %}
loads the right avatar. I don't see why simply placing the code inside a loop of site.authors
should change its behavior.
First of all, your example doesn't make sense.
Good catch! Its a typo! Would you be interested in submitting a pull request to correct it?
Regarding the main issue here, it needs some investigations. I'll look into it.
I've not been able to reproduce this.
I tested with a boilerplate site (wired to use jekyll-avatar-0.7.0
) containing the following page:
---
author: tblobaum
---
{% avatar {{ page.author }} %}
{% avatar ashmaroli %}
It rendered as expected into below:
Either I do not understand the issue or something is wrong at your end. If former, please provide a reproducible repo.
Repo is: https://github.com/tblobaum/thenewworldpost.com
If you clone the repo you first need to uncomment jekyll-avatar
in the Gemfile and _config.yml (they are both at the bottom of the page) then you can run it with bundle install
and then bundle exec jekyll serve
then navigate to _layouts/post.html
and paste at the top of the file somewhere {% avatar {{ page.author }} %}
then navigate to the entertainment/2022/01/01/kylo-ren-of-star-wars-the-force-awakens-was-inspired-by-nazis.html
or another post on the homepage of the website which has tblobaum as the author in frontmatter. If you open up _posts/entertainment/2015-11-28-kylo-ren-of-star-wars-the-force-awakens-was-inspired-by-nazis.markdown
you can see in the frontmatter author: tblobaum
yet the avatar being rendered is for the github usernamed Thomas
@tblobaum I have been able to reproduce the issue using your repo. (You forgot to tell me that I should clone gh-pages
instead of master
.. pfft! smh!).
Anyways, the issue seems to be differences between Jekyll 3 and Jekyll 4.
You should be able to use this plugin either by using Jekyll 3.9 via gem "jekyll", "~> 3.9"
or by pointing the jekyll-avatar
gem to this repository:
gem "jekyll", "~> 4.2.1"
gem "jekyll-avatar", github: "jekyll/jekyll-avatar"
Related: #59
Hi, v0.8.0 has been released. Please upgrade and confirm if this issue has been resolved. Thanks.
{% avatar {{ page.author }} %}
for some reason tries to load the avatar based on the name of the author instead of the username passed in{{ page.author }}
istblobaum
tblobaum
has name set as Thomas Blobaum in GitHub{% avatar {{ page.author }} %}
tries to load the avatar for "Thomas " instead of tblobaum