File section filter only documents

Hi everyone! Is possible in a files section filter by type of file? I want to only display documents not images. Thanks in advance!

Yes, that’s possible. You need to assign a template to the files section and in that files blueprint, set the accept option.

sections:
  docs:
    headline: My documents
    type: files
    template: docs

In /site/blueprints/files/docs.yml

title: Documents

accept: application/pdf # comma separated list of accepted mime types
1 Like

Oh thanks! I didn’t new about accept option on file blueprint.

You are the best @texnixe!

1 Like

Why is it not possible to use query: page.documents

In a files section you cannot use queries. You can only filter by template (however, you can use a separate template for a files section that only allows uploading documents and filter that way).

As an alternative, there’s also my GitHub - texnixe/k3-filesdisplay-section plugin.

1 Like

Ok. Is it possible to display a usagecount here? Count = if the files are used in a txt.

Yes, you can achieve this with a custom method. Depending on where you use the files (e.g. in a textarea field via a kirbytag) that would require some text parsing though).