How to query by the current file name

In a file I want to automatically include a list of all files whose name includes the name of the current file.

I don’t want to hard code the name of the current file in the query. I want the name of the current file to be included automatically. So currently I have this:

```query
file:"This file name"
```

but instead I want something like this:

```query
file:"{file.name}"
```

How can I do this?

I suspect I can do this with DataView but is there a way I can do this with query? (I prefer query because I think that’s built in, whereas DataView is a community plugin and I like to rely as little as possible on those, for security and resilience.

Ah, I’m always happy to see someone else who recognizes the value of the embedded search feature! Unfortunately I think what you’re asking about isn’t a thing.

Indent every line of the block by 4 spaces (the original Markdown way to mark a code block).

A few times I’ve wanted to automatically include the current file name, not only in query blocks but in tasks and other places. Seems weird it’s not a feature.

Thank you. Fixed

I have to admit I’ve never felt the same desire.

If you can find a way to work templates into what you’re doing, you can use the {{title}} template tag (which will hard-code the name, but you won’t have to type it).

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.