WordPress search results - author avatar

I have written a custom template for returning Algolia search results on my WordPress theme. The part I’m stuck on is how I might possibly retrieve the author’s avatar. I can get the author ID, and I know passing that into the php function get_avatar would return it, but I don’t think I can use php in the template.

The relevant author logic block is here, with img tag commented out:

Hi @peiche,

Thanks for contacting Algolia and apologies for the delayed response!

As you know, we index a defined set of attributes for posts automatically (see here).

We also have an example for how to include custom attributes that you would like to add (see here).

Have you considered trying to get the avatar url and making it a new custom attribute like author_avatar_url?