Maybe an error in cookbook/templating/authors

Hi, if I past this code from cookbook/templating/author list in my blog page, with sames fields etc… it should return?:

author1
 article 1
 article 2

author2
 article 1
 article 2 

But only articles from first author are displayed.
If I delete author from the first article, it will show articles from 2nd author only etc…

is it an error in the doc or do I anderstand something wrong?

No there is an error in the provided code.

Change in authors.php template
from

    <ul class="articles">
    <?php
      // filter all articles per author
      $articles = $articles->filter(function($child) use($author){
        return in_array($author->email(), $child->author()->yaml());
      });
      foreach($articles as $article): ?>
        <li><a href="<?= $article->url() ?>"><?= $article->title() ?></a></li>
      <?php endforeach ?>
    </ul>

to

    <ul class="articles">
    <?php
      // filter all articles per author
      $authorsarticles = $articles->filter(function($child) use($author){
        return in_array($author->email(), $child->author()->yaml());
      });
      foreach($authorsarticles as $article): ?>
        <li><a href="<?= $article->url() ?>"><?= $article->title() ?></a></li>
      <?php endforeach ?>
    </ul>

1 Like

If the cookbook code has an error, this should be reported as an Github issue for the getkirby.com site or to @texnixe as to my knowledge she takes care of the docs and cookbook in an excellent way.

1 Like

At Creating authors there is another error on that page I think:

The field email in the blueprint has the same name as the default field of a K3 user $user->email().

I suggest @texnixe to erase this field in the blueprint file.

@anon77445132 As @warg wrote and as you know already from previous discussions, we keep our issue list both for Kirby issues as well as issues with the site on GitHub.

This has multiple advantages for both you and us: It’s much easier to keep an overview over open issues and we won’t forget anything (meaning: issues are much more likely to get fixed). Also a single place to report issues avoids that issues are reported multiple times and reduces the time to search for issues that have been reported in the past.

So: Thanks a lot for your feedback on the docs. It would help us a lot if you opened GitHub issues for the problems in the docs. We won’t fix those issues otherwise for the reasons mentioned above. I hope you understand.


@Constantin Sorry that you didn’t get a reply in May when you created this topic, seems like we missed it back then. Have you found a solution in the meantime?

1 Like

I have no account at GitHub. So I cannot open an issue there.

Is there any specific reason why you can’t open an account at GitHub? It’s a very common service in the open-source community after all.

Except to give issues for Kirby, I don’t need an account at Github.
In this respect I make use of the data austerity according to GDPR.

Thank you @lukasbestle for asking, Kirby community is still the best :wink:
I was playing with what the cookbook offers, did not really need a working solution at this time.
Thank you all for your help and comments.
Issue has been created on github.

2 Likes

Thanks. :slightly_smiling_face: