Search code examples
twigbolt-cmsfile-listing

Loop over files in Twig


I am using Bolt CMS and want to have a table including all files of a specific directory on the server. How can this be achieved using a Twig template?


Solution

  • I have found that the following call works. The argument is a path in the files directory.

    {% set files = app.filesystem.browse('SomeDirectory')[0] %}