How to find links without notes?

Howdy,

I typically create multiple [[xyz]]s as I go, so I have a glossary of sorts. Later I want to fill-in exactly what an xyz is, but there are hundreds of these things so I have two questions:

  • how do I find all of the uncreated mentions - e.g. how would I know xyz is even a thing
  • how do I know if I have already created one or if I need to create a new one

For the first question, I can’t simply load the original page in which I first entered xyz and then look at the “Unlinked mentions” because I can’t recall in which page I referenced xyz (there are literally hundreds of these things ;-))

Thanks!

7 Likes

Pages not linked to any other page show up on the periphery of the graph. I use that to locate pages that I have not linked yet. But I agree, this could be improved.

@raivivek, I think he’s describing the situation in which he’s linked to a page that doesn’t exist. The graph shows existing pages that aren’t linked.

@yatesco, I haven’t seen this functionality in Obsidian yet. For now I’d probably create an external script to find all unique instances of [[thing]] for which there is no thing.md file.

2 Likes

I’m not sure I understand fully. But perhaps find one instance (with cmd+f or search) to create the initial link and then follow unlinked mentions, repeat for each thing?

Alternatively reading your post reminded me a bit of this use case I was having troubles with so perhaps it’s similar to what you’re experiencing?

Thanks both - if it helps, New note should show existing links without any notes would be one solution; namely having access to a list of links that have no notes, that all I need :-).

Ah, so a list of blank links. Yes I would like that. Perhaps that could be a page in Obsidian that you could browse. Checking off which you’d like to have files be created (or create file for all blanks)

2 Likes

I typically create multiple [[xyz]] s as I go, so I have a glossary of sorts. Later I want to fill-in exactly what an xyz is

I do the same!

I just use {{note I want to create}} and then occasionally search through my vault for {{ to find them, since I’m not using two curly brackets for any other purpose.

But yeah, I do believe that there should be some obvious way to check for broken [[links]] from within the interface.

This would be very helpful. I have a similar workflow - adding links as i type without creating pages

So I just did a cleanup using VS Code. It’s not the easiest way, but it works. Hope it helps :slight_smile: (It goes without saying: first try on a copy of your fault)

  1. Empty .trash
  2. Write all filenames to a text file. In terminal: find . -type f -name '*.md' > files.txt
  3. Clean up list of filenames. In VS Code:
    1. Find (with regex) → .*\ replace with nothing (to remove path)
    2. Find → .md replace with nothing (to remove extension)
    3. Now you have a list of only titles
  4. Find all links in vault. In VS Code:
    1. Install ‘Sort lines’ plugin
    2. Open vault-folder
    3. Find all (with regex) → \[\[(.*?)\]\]
    4. Open search results in editor
    5. Copy search results in editor to new file
    6. Perform same search in new file
    7. shift+cmd+p → Select all occurences of find match
    8. Copy + paste
    9. shift+cmd+p → Sort lines (unique, etc...)
    10. Find and replace [[ and ]] with nothing
    11. Save as links.txt
  5. Now you have two files. One with all the links and one with all the files. We want to find all the dead links. That means the lines from links.txt that do not occur in files.txt. In VS Code:
    1. In files.txt
      1. Place a cursor at the start of each line by holding option+cmd+↓ until the end of the file
      2. Type (\n
      3. Move to the end of the line
      4. Type )|
      5. Press delete so that all lines become 1 line
      6. Remove the pipe at the end
      7. The line should now look like this: (\ntitle one)|(\ntitle two)|(\ntitle three)
      8. Copy the line
    2. In links.txt
      1. Find (with regex) and paste the line
      2. shift+cmd+p → Select all occurences of find match
      3. Now all the links that are also files are selected
      4. Press delete
      5. Now all the lines that are left are dead links
      6. Save the file as deadlinks.txt
  6. Ok so now we have all the dead links, so we want to remove all the square brackets for those = replace all the [[Title with dead links]] with Title with dead links. Still in VS Code, in deadlinks.txt:
    1. Find (with regex) \n and replace with \| (pipe)
    2. Surround the resulting line with \[\[( and )\]\] so that it looks like this: \[\[(title one|title two|title three)\]\]
    3. Find all (with regex) and paste the line from deadlinks.txt. Now you should see all the dead links form your vault in your search results
    4. Replace with $1
    5. Click the ‘replace all’ button
    6. Done
1 Like

I also like to create wiki-links as I go, and don’t want to interrupt my writing by following those rabbit trails right away. I just discovered that by enabling the Preview Mode plugin, I can do a quick sweep of the wiki-links in a note (ctrl + mouseover) when I’m done. If it’s an orphan link, I’ll see an “xyz has not been created yet. Click to create.”

I may click to create but not have time then and there to flesh it out. To prevent blank and incomplete notes from cluttering up my zettelkasten, I’ve changed the File settings so that new notes appear in a folder labeled “Inbox.” Having them clearly marked makes it easier to come back to and clean up or delete them. Once the notes are complete enough that they’ll make sense to me a month from now, they graduate to my Permanent Notes folder.

If I were you, I’d use preview mode to hunt down your orphans find good homes for the orphans a few at a time, rather than a bulk script. Filling in your glossary will be more beneficial when you see the word in context, and will be less demoralizing seeing 100 blank notes appear in your inbox!

As an aside, maybe orphan isn’t the right term. These notes have parents, but they haven’t been born yet. Embryonic notes… Seeds of an idea…

2 Likes

I use “[[entity links]]” frequently as well – often for proper names (people, books, etc). It looks like the graph shows these uncreated link-entities with connections to their backlinks. Clicking on the uncreated link-entity’s node will generate the actual note in the folder you designate for new notes (mine is “Inbox”).

If these uncreated link-entity nodes could be visually distinguished – say, by a color – from note-nodes, it would be easy to go in and create the actual notes if you needed to.

1 Like

An excellent idea, this would help me in identifying those links where I need to add a note for.

Hello,

See my take on the solution at Script - Find orphaned links (linking to no existing note)

Happy to get your feedback if any!

Replying to myself and others! Looks like version 0.94 incorporates this suggestion:

Blockquote In preview mode, internal links to notes that don’t exist yet are now given the CSS class is-unresolved, and now shows up in a different color than links to existing notes.

I just tested it and it works…