Bear App Backlinks Help - Zettelkasten

Thanks in advance for any assistance that can be provided:

Workflow Need:
I am trying to create a set of backlinks for each Bear note that I have through iOS Shortcuts that separates “Direct Links” (notes linked through the wiki link feature - [[...]]) and just references to the Note/Concept. For example, I am trialing Bear as a Zettelkasten. So I have hundreds of notes that are just simple concepts or ideas - (e.g. “Supply-Side Economics” or “Radical Hope”) - that are titled according to the concept/idea. At the bottom of each note, I want to track all ‘inbound’ links throughout my database. In other words, all notes that link or reference the given concept/idea.

A visual example:

As you can see from the above example, Here is a note “Reaganomics” that has a set of backlinks where I have linked to Reaganomics. In the second image, here is a lecture I give which refers to “Reaganomics.” I have made the shortcut to create the backlinks (Bear Backlinks Shortcut). However, I have two problems:

Problems:

  1. I would like to distinguish between direct links and indirect links. That is a “direct link” would be like the example above where I have a wiki link between the notes. HOWEVER, my shortcut also pulls in non-wiki linked notes (or indirect links), BUT they have the word “Reaganomics” in it. I WANT that, it is wonderful. However, I would like to distinguish between direct links and indirect links — (Q) So is there a way to search in Bear App for direct links and distinguish them from indirect links. All “direct links” are bracketed, and you can search for them. But I am struggling to create a Shortcut that does both. For example, if I could search for the term in Bear without The brackets, or search for all of them, then subtract from a duplicate section the bracketed ones??? Idk?
  2. The second problem is relatively simple. How can I get the UUID for a note out of the “Shortcut Input” data?? Basically in my shortcut I am appending the backlinks to the note that I share to shortcuts, but I am manually copying the UUID to the clipboard beforehand so that when it appends, it knows where to do so.

Any assistance would be greatly appreciated. I know it will make my teaching far more efficient. Or at least in preparation for teaching.

mark

I currently

I solved my second problem with some x-callback url magic I was able to discover.

I’ve created a script for this exact use case in Scriptable (if you’re interested in learning/already know JavaScript, it’s SO much easier to make complex workflows in it). Although I didn’t include indirect links, that’s a clever idea.

So is there a way to search in Bear App for direct links and distinguish them from indirect links. All “direct links” are bracketed, and you can search for them. But I am struggling to create a Shortcut that does both.

AFAIK the only way to do this will be to search for your term, then parse through the text body yourself. Example workflow:

  1. Search for all Bear notes with “Reaganomics”
  2. Repeat per note
  3. Regex match on the file contents: if there’s a match for \[\[Reaganomics\]\], this file is a direct link, otherwise, indirect.

I haven’t looked at your shortcut though so I might be missing some context