getFiles returns every file in the folder

Pitfall By design
docly.getFiles(folder) returns every file in the folder – documents, but also .hash files (redirects, helpers) and uploaded files such as SVG icons. A listing that filters only on x.Title shows them as empty or odd cards. Filter on the schema: x.fileschema == "YourSchema".
Applies to: Hash templates

What you'll see

An overview page, a menu or a sitemap builds its list with docly.getFiles("services"). Later someone adds a non-document file to the same folder – a redirect file after a page moved (Old-page.hash), or an icon uploaded next to the pages (icon-overview.svg). The next render shows a card titled Old-page.hash with a broken image, or the icon appears as if it were a page.

What's actually happening

getFiles lists the folder, not a schema. Every item has fileschema: the schema name for documents (for example Tjenesteside), and values such as Code File for .hash files. Checks like x.Title do not help – non-document files also get a title (the file name).

Observed on a live site: after two service pages were replaced by redirect files, the services overview grew two empty cards, and an uploaded SVG icon showed up as an extra item in a list of subpages.

What to do

Do – filter on the schema you expect:

let pages = docly.getFiles("services").filter(x => x.fileschema == "Tjenesteside");

In a sitemap that covers several schemas, exclude code instead:

let isDocument = (x) => x.fileschema != "Code File";
#for (let item of docly.getFiles(folder).filter(isDocument)) {# … #}#

Don't rely on x.Title, a file extension check on the URL, or the assumption that nobody will ever put anything else in the folder.