So i finally managed to find time to start digging in and learning how the guts of Kirby actually works. I learn by breaking things, basically. I’ve learned a LOT today! ha!
So somehow I have managed to successfully edit my site info, footer, article blueprint, article template and blog template. I have mostly implemented the IndieWeb microformat h-entry code, minus a few things. One thing I need is to import the user avatar with the username. For this blog, that user is me. No other users, so that should simplify things. If I do a second blog, that one will have two authors, but I’ll cross that bridge when I come to it.
Do I need to add a separate image field to the blueprint before calling it from the template? I did the user name that way, but was wondering if I need to clutter up the panel, especially since, again, there’s just one author here…
You can add an avatar to the Panel user, then get it in your template via the $user->avatar()method if that fits your use case, see example in the docs: https://getkirby.com/docs/cheatsheet/user/avatar
In that cheatsheet, the $user->avatar() is not actually used in their example code. And their example mentions a specific user, not code to call the user.
So if I have a user with an avatar (added in the panel or yml, either way) and that user creates a post, how do I call the user/author and their avatar? Currently I have an author field in the blueprint and call it using <?= $page->author() ?> but I can’t insert that into the example PHP without breaking the page. Each post will have an author w/ an avatar, just trying to display both in each article (next to the timestamp).
@demlak The code above will work if you use Panel users. Are you talking about Panel users? The code won’t work like this if you use the author system you described in the other post?
Edit: It’s better to use an if-statement anyway to make sure the user exists first (might be that a user is stored in the file and later removed):
@texnixe
thx a lot for your help… this in here is not related to the other thread… =)
i did not know, that it is possible to add extra info to panel users… and read out all of them. =)
so i try this instead of extra author-system
i’m able to print the authors name (in my example it is demlak, which is the same as the panel-user) by:
<?php echo $article->author() ?>
if i add the username manualy, then the if-statement works.