Query request: find all pages referenced as a list


I’m trying to improve my tag discoverability. I’m already using Get a list of pages that refer to the current page? which gives me list of pages referencing the current page. I would like the opposite query as well: all pages referenced by the current page.

E.g. if I’m on a page page1 and I have

- page1
  - page2
    - page3

somewhere in my graph (doesn’t matter if it’s in a journal or not), then the query should return page2 as a result. I’m not sure if page3 should be returned as a result, but ultimately it would be good to make the nesting level configurable

These are two different things.

The first would be anywhere on page1 a reference like [[page2]] or #page2.
Can be discovered by opening the sidebar and selecting page graph.

The second is a block that references page1 with child blocks that reference other pages.
Which can be discovered by changing the query you already have to return the blocks instead of the pages.

Please clarify what you are specifically looking for so we can help you further.