This question is based on another one that found only a partial solution (workaround) - but there should be a better solution, I'm convinced. However, I'm stuck. Here is what is already clear:
In an atlas, you can get for each page of the atlas output a list of the elements (say: towns) on this particular atlas page - a list of the towns that appear on this particular atlas page. So for every page you get a list of the towns that appear on this particular atlas page.
Now here is the question:
How is it possible compose (let's say on a separate layout-page) all features (all towns) and list them together with the no. of the atlas page they appear on? In the most simple case you have one layer towns and one layer rectangular polygons, the last one is the one that creates the atlas pages.
As a starting point I thought about using an expression used on the towns-layer, based on intersects( $geometry , @atlas_geometry )
, however I'm not sure how to integrate the page-no. The variables @atlas_featurenumber and @atlas_featureid can both be used to refer to the current page-no on each individual atlas-page, but i don't see how it could be used the refer to all the pages (not just the current one) in a separate list. I thought of using an array, but I'm stuck with how to set it up and use it accordingly. Final aim is to create a register of all towns that lists the page-no. of the atlas on which they appear, like:
town a page 4
town b page 7
town c page 19
town d page 4