{% comment %} Avatar Exists Helper Loop through all the assets to find if there's an image with the same name as a user profile. It currently support JPEG and PNG images. {% endcomment %} {% assign avatar_formats = ".jpg|.JPG|.jpeg|.JPEG|.png|.PNG" | split: "|" %} {% assign avatar_exists = "false" %} {% assign avatar_name = "assets/img/people/" | append: person[0] | relative_url %} {% for static_file in site.static_files %} {% for avatar_format in avatar_formats %} {% assign avatar_path = avatar_name | append: avatar_format %} {% if static_file.path == avatar_path %} {% assign avatar_path_exists = avatar_path %} {% assign avatar_exists = "true" %} {% endif %} {% endfor %} {% endfor %}