I have several dozen “area” and “project” notes that include dataview
and tasks
queries. These queries reference the current note’s title using this.file.name
or this.file.link
, to show context-specific results — like tasks or notes associated with that area or project.
Here are simplified examples of the kinds of queries I’m using:
[filter by function (task.file.property('area') || "").includes("[[" + query.file.filenameWithoutExtension + "]]");]
list
where (contains(area, this.file.name) OR contains(area, this.file.link))
These queries are always placed near the top of the note, using the same structure in every file. I use Templater to insert them when creating a new note.
The problem is: when I need to change the logic of these queries — for example, to refine a filter — I have to manually update every single note. Since the queries depend on the file title, I can’t just transclude a shared partial; the context (this.file
) becomes that of the partial, not the host note, and the queries break.
I’m looking for a way to avoid editing each note individually when I want to update these query blocks. This could be a Templater-based solution, a plugin, a batch-editing method, or something else. I’m also open to using JavaScript, regex, or external tools if needed.
If anyone has solved a similar problem, I’d really appreciate hearing how you approached it.
Thanks.