Skip to content

Filesystem Collection

Johan Janssens edited this page Mar 10, 2021 · 23 revisions

The filesystem collection allows you to easily retrieve data from any path in the filesystem. The files should contain structured data. The supported data types are YAML, JSON, INI, PHP, XML and MD (markdown)

Table of contents

Frontmatter

A filesystem collection can be defined easily by specifying the path where the collection should be retrieved from, for example:

collection:
   model: filesystem?path=data://team/members

Note: filesystem is a shortcut for the com:pages.model.filesystem identifier

The path parameter defines the location for the filesystem collection and can be templated using the template URIs standard. When a template URI is used, the model state will be used to expand the template URL, for example:

collection:
   model: filesystem?path=data://{+path}{/segments*}
   state:
     path: /foo/bar
     segments: ['one', 'two']

The resulting model would be filesystem?path=data://foo/bar/one/`.

Query path

If the path starts with data:// it will be loaded through the data registry. If not the file will be loaded directly.

See also: Data

Custom Collections

To create custom filesystem collections you need to extend the ComPagesModelFilesystem class.

Example

[todo]