Is it posible to test if a file exists inside twig template ?
To my knowledge, you’d have to accomplish that with a Twig extension (via a plugin). Google returns some ideas. There are at least three twig-related plugins in the repository that you can look at for guidance.
Would be simple to write a custom twig filter that took a file path and tested if file_exists()
@Perlkönig @rhukster thanks, I will write my own first twig filter I start with :
https://learn.getgrav.org/cookbook/plugin-recipes#output-some-php-code-result-in-a-twig-template