obsidian.templater.search.dnp.backlinks.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<%* | |
const search = app.workspace.getLeavesOfType("search")[0]; | |
const dnp = tp.date.now('YYYY-MM-DD'); | |
const dnp2 = tp.date.now('YYYY_MM_DD'); | |
search.view.setSortOrder("byCreatedTime"); | |
search.view.setCollapseAll(false); | |
search.view.setExtraContext(true); | |
//looking for backlinks only | |
let finalQuery = `/\\[\\[${dnp}(\\]\\]|\\|)/`; | |
//Optional - looking for date with underscores too | |
finalQuery = `${finalQuery} OR /${dnp2}/`; | |
//Optional - looking for file name with date in it | |
finalQuery = `${finalQuery} OR file:(${dnp})`; | |
//Optional - exclude weekly review and today DNP | |
finalQuery = `(${finalQuery}) -file:(/^${dnp}[^a-zA-Z0-9_]/) -file:("weekly review")`; | |
//Add query to search | |
search.view.setQuery(finalQuery); | |
app.workspace.revealLeaf(search); | |
%> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks for making and sharing this templater. Unfortunately, this one doesn't work anymore.
Here is the console report:

I used to used a similar templater that I forget where I get it from (maybe from your Github?), below.
I do need your help to fix this templater if you don't mind, since it is so helpful for me to find other files that contain a particular unresolved link. I made tons of unresolved links as opposed to tags. Also, I don't know about coding at all.
Many thanks in advance!