Dataview question - Pages that start with "Project - " or link to the page "Project"

Assume the following 3 page setup in my vault with the following pages and content:

  1. “Project - take over the world.md”

TODO develop this plan

  1. “Make dinner.md”

this is a [[Project]]
note - the Project page isn’t really created

  1. “Projects.md”
TABLE file.mtime as Edited
FROM "" 
WHERE
contains(file.name, "Project") AND
(
    file.name != "Projects"
AND file.name != "Project"
)

I’m trying to script the Projects page to return the prior 2 pages

When I am in reading view - the “Make Dinner” link is not present. :frowning: All I have is “Project - take over the world” which I’ll need to do on an empty stomach.

What change to the dataview query is needed in order to also pull in pages that link to the [[Project]] ghost page? Does it involve file.outlinks.file.name?

Hi.
A good structure of the metadata is a halfway to work well with dataview.
I advise you strongly to explore more queries examples and plugin documentation in order to question the way you organize the metadata in your notes.
[[Project]] is an outlink… You can’t target this «metadata» through file.name.
Your WHERE conditions means:

  • contains(file.name, "Project") → files that the title contains the word “Project” (in your 3 files examples, only the note Project - take over the world.md complies this condition ,because you exclude “Projects” in file.name != "Projects");
  • the AND operator display the files that comply all the conditions;
  • if the file [[Project]] doesn’t exist, this file.name != "Project" is irrelevant (dataview only get metadata from existent files, not from “ghost” files).
  • etc.

I’m not in your place and I don’t know the logic of your metadata structure. From my side, I think in two options:

  • in each “project” notes add a #project tag → with this solution you can use this query:
TABLE file.mtime AS Edited
FROM #project
  • if you want to use [[Project]] instead of a tag, rename “Projects.md” to Project.md (now the file exists) and do a query tho list all the backlinks (inlinks) to that page:
TABLE file.mtime AS Edited
FROM [[#]]
1 Like