I would like to collect all pages that mention not just this.file.link, but specific heading, like 'this.file.section`. For example:
My Page
Some content, bla-bla-bla
RequiredSection
list from "Folder_with_notes" where contains(file.outlinks, *this.heading.link*)
Note from folder
Topic: [[My Page#RequiredSection]]
End of example
As bonus: dataview request that searches for links with no headings or headings not met in file, like
list from "Folder_with_notes" where contains(file.outlinks, this.file.link) *and have no subpath or have subpath not listed in file*)
Things I have tried
Was able to make something with manual heading comparsion:
list from "Folder_with_notes" where any(file.outlinks, (x) => (meta(x).path = this.file.path) and (meta(x).subpath = "RequiredSection"))
and for generic search
list from "Folder_with_notes" where contains(file.outlinks,this.file.link) or any(file.outlinks, (x) => (meta(x).path = this.file.path) and (meta(x).subpath = "Other_notes"))
but that required to change dataview request for every new heading, that’s annoying, would like to have some kind of autodiscovering for current heading
DataviewJS is acceptable, but preferred to have solution with DQL. For now I have almost same system with subtags, but I have no option to jump to My Page or have to duplicate link and tag
As far as I know, the section links are only available from list/task items. This does however also mean that you could do a little trickery like having a list item within the section you want to refer to, and then pickup that section link from that item somehow.
Both options are interesting workaround concepts, but I don’t know how the first one will work if every section will have a list item with the same tag and second one looks not really applicable as you probably will rewrite metadata “requiredSection” for page. Probably, you can’t have lots of independent “requiredSection” fields?
It looks like it’s easier to duplicate tag with section and link without section in the note pages I would like to refer.
Anyway, thanks for help!
Both suggestions would indeed require for the field/tag to be unique on the page in question.
I’ve not seen it, nor looked for it, whether dataviewjs has a reference to its own location, and thusly the section. It could be it has that, but I’m not sure. If it had, that could possibly be an option. It’s rather easy to add a little framework around the DQL query, so you wouldn’t need to know javascript to use that option.