This is the first thing I tried, but then I noticed that there are no templates assigned to files. For example, in the cookbook, files with template protected are filtered.
I have about 900+ files that are grandfathered from Kirby 2 and therefore have no file template attached to them.
The strucutre is one subpage with page template document, and file linked in field, this is how document.txt file looks like for this folder: