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!

10 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 :-).

1 Like

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)

4 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
4 Likes

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…

3 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.

3 Likes

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!

2 Likes

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…

I am not understanding how you go about doing this. I also have plenty floating in the graph, but don’t know how to view them together.

I see you mentioned something about the preview mode? Could you please elaborate?

Thx.

Yeah, I was wrong about that. The release notes refer to visualizing a non-existent internal note in preview, not in the graph.

But there is a css class for nonexistent files in the graph. So you should be able to see these depending on your theme, I suppose. See the attached screenshot:

Screen Shot

You could conceivably use a CSS snippet to provide greater contrast for the nonexistent nodes.

You also might be able to use a graph filter to show ONLY your nonexistent notes. There’s already a toggle to hide nonexistent notes.

Jack

I am trying to figure out how to do that. For example, I have many people notes with [[@name]] that are non-existing files. I also have many non-existing [[random concept]] files. I was hoping that I could filter out the people notes by -file:@ but that kind of filter doesn’t work for non-existing files as it seems.

So is there a way to filter the graph based on the note titles of non-existing files? Or is there at least a way to see non-existing files only?

Well, I have been messing around for an hour and I can’t find a way to use the Obsidian query to show ONLY nonexistent notes. I have come across feature requests to achieve that result, so who knows… maybe some day.

But as I said above, you can use CSS to visually distinguish nonexistent notes. I use the snippet pasted in below:

/* to style the new nodes in the 0.9.1+ */
.theme-light .graph-view.color-arrow {
color: #5cc863;
}

.theme-light .graph-view.color-fill-tag {
  color: #440154;
}

.theme-light .graph-view.color-fill-attachment {
  color: #277f8e;
}

.theme-light .graph-view.color-fill-unresolved {
  color: #fde725; 
}

I think @Klaas maintains the css snippets repository. Here’s the URL for this snippet: obsidian-css-snippets/Graph nodes.md at develop · Dmitriy-Shulha/obsidian-css-snippets · GitHub

Below, this is a sample graph where I made the non-existent (i.e. unresolved) links red (#ff0000)

Screen Shot 2021-05-13 at 3.24.51 PM

2 Likes

There is a plugin called “Find unlinked files and unresolved links” that’s helps a lot. It generate a page with all the “unlinked files” and another, if you want, with “unresolved links”. All the results are internal hyperlinks that brings you straight to the given file.

the option #3 should be used with precaution

3 Likes

Also another plugin: “Dangling links panel”

It creates a panel to the right side column which lists links that do not have notes.

I did not try “Find unlinked files and unresolved links” because I do not wish to create a new file to list links.

5 Likes