List authors on front end by total number of entries I need to output a list of channel authors. There are about 40 authors but I want the 8 authors with the most entries. Not sure how to achieve this.

What I have so far:

    {# get all the itbuzz entries #}
    {% set allEntries = craft.entries.section('itbuzz').all() %}
    {# get all the authors #}
    {% set authors = craft.users.group('itBuzzAuthor').limit(8).all() %}

    &lt;ul class="flex flex-row flex-wrap"&gt;
      {% for author in authors %}
        &lt;li class="inline-block mb-4 mr-4 text-sm text-center"&gt;
          &lt;img src="{{ craft.gravatar.url( author.email ) }}" alt=""&gt;
          &lt;a href="#" class="text-blackBrand"&gt;{{ author.firstName }}&lt;br&gt;{{ author.lastName }}&lt;/a&gt;
        &lt;/li&gt;
      {% endfor %}
    &lt;/ul&gt;


All this does is output the first 8 authors, it's not finding the 8 with the most entries.
You could do something like this:

{# Fetch entries + authors and group by author id #}
{% set entriesByAuthors = craft
    .entries()
    .section('itbuzz')
    .limit(null)
    .with('author')
    .all() | group(e =&gt; e.author.id) %}

{# Build an array with authorId and entry count for each that we can sort them #}
{% set leaderBoard = [] %}
{% for author, entries in entriesByAuthors  %}
    {% set leaderBoard = leaderBoard | merge([{'author' : author, 'count' : entries | length}]) %}
{% endfor %}

{# Build an array of user ids only sorted by entry count and extract the top 8 #}
{% set authorIds = [] %}
{% for result in leaderBoard | multisort(e =&gt; e.count, direction=SORT_DESC) | slice(0,8) %}
    {% set authorIds = authorIds | merge([result.author]) %}
{% endfor %}

{# Fetch users based on our sorted and sliced array of ids #}
{% for author in craft.users().id(authorIds).all() %}
    {{ author.firstName }} - {{ author.lastName }}&lt;br&gt;
{% endfor %}