Filelist
The filelist contains by default all image files of the current page. The selection of files can be modified by using the filelist function. Check out this detailed example of how to use a filelist. Similar to the pagelist object, it is possible to get the number of files in the filelist using the :filelistCount
variable.
Related Runtime Variables
- :filelistCount
- The number of files within the filelist.
Example
A simple example of how to use the filelist function to select and sort files. Multiple glob patterns can be separated by commas.
<@ filelist {
glob: @{ files | def ('*.png, *.jpg') },
sort: 'asc'
} @>
<h2>@{ :filelistCount } Images</h2>
<@ foreach in filelist { width: 400 } @>
<p><img src="@{ :fileResized }" /></p>
<@ end @>
Note that glob patterns are always relative to the current page, unless they begin with a
/
. Patterns starting with a/
are always relative to Automad's base URL.
Read more about using the filelist object in a foreach
loop here.