As a pastor, Obsidian with the official Readwise plugin has become a core part of my study workflow. I tag my highlights in Readwise, and each week I have an overview page with an embedded query (w/ Query Control, of course!) to pull in all relevant highlights.
It works well as is, except for one nagging issue…
What I’m trying to do
In an embedded query, show only the filename, not the entire path.
Short of moving highlights to a flat folder structure, I’m not sure what else to try. I’m willing to write a plugin if necessary, but wanted to check with the community first to see if there is an existing solution I’m missing first. Thanks!
The title is the first thing people see, and they use it to judge if they may be able to help, so it pays to make it informative. If some repetition happens because of it, that’s all right.
file: and path: do different things. This was just for testing, if search for file: displays the path in the user interface.
Obsidian’s Search feature seems to be designed to display everything it finds. So when you search for path content, it will show the paths. The behavior makes sense to me.
As a solution, you could place all necessary data in the notes themselves. Then you wouldn’t have to search for the path.
For example by adding “highlights” as a tag to your YAML frontmatter properties. Then you could search for this:
tag:#highlights tag:#bible/daniel/7
I don’t use Readwise. But if it works similar to Omnivore it is possible to add tags to the template. A well designed template made all the difference for note import.
I would investigate using CSS before jumping to JavaScript for this. This post can help you examine things to find the correct selectors (if they exist): Obsidian CSS Quick Guide
does it run again and again to hide the path? @holroy
It only runs the check when you switch notes.
It just watches the <head><title> element… and if that title changes, it means you opened a different note, so it checks (once) if that note contains an embedded query…
If the new note does contain an embedded query, it runs the hidePath() function to clean the embedded paths (/books/daniel.md >>> daniel)
[That 300ms you asked about is just a delay to let the note load before checking (it’s not a repeating check)].
**
If you want - you can see exactly when everything runs - just uncomment these two lines in the code:
// console.log('leaf switch');
// console.log("scrubbed q paths. " );
Now, when you switch notes, it will say “leaf switch” in console.
And if the new note has embedded queries, it will say “scrubbed q paths” (and it will clean the paths).