How to find links without notes?

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.

6 Likes

Hi,
After reading through this thread, I only find workarounds and no convenient solution:

  1. Install one of the suggested community plugins. These look great, but this would mean to disable Safe mode and click OK to the scary (and I believe warranted) dialog about opening up your computer pretty much completely to whoever the community creator is. (unless I have the time to go through the source code and build the binary from those sources - and do this every time there’s a need for an update)
  2. Add a style sheet that makes the links without notes jump out. But this means scrolling around / resizing the graph to try and spot these notes. Not exactly convenient when I don’t care where they are in the graph - I just want to create a note for them.
  3. Scan through all the links in a note before I leave it to validate that no link without note exist. The preview of links will help to identify the blank links. I don’t want to have to remember and spend time on this for every note though.
  4. Prefix every “blank link” with some special characters (e.g. {{) so that I can quickly search for these characters later and find all the blank links. I can see this working quite well, but it is extra work to put in the characters and makes the text ugly.
  5. Do a complex search for all links, then all files and do a diff to find any links without matching files.
  6. Quickly click each blank link so that it is created, and then jump back to your note to continue and hope that you didn’t interrupt your train of thought. With default note creation set to something like an inbox folder, the blank notes can then later be fleshed out.
  7. There’s a nice looking script provided to generate a note that lists out blank links. But it is for Mac only, and still requires to run a command externally (or set it up to be run somehow periodically).

@moderators , would it make sense to unmark this from being resolved, or we have to make do with the workarounds that exist?

2 Likes

I would also like a solution for this.

There is already a toggle in the graph view for turning showing/hiding existing files. It shouldn’t be that much effort to use that info to a search filter we could use.

1 Like

Hey you can try various complements plugin its available in obsidian store download it and enable and then like if you have note in your vault as xyz then if you want to link it then you dont require to asd [[]] these brackets to link it is very usefull

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.