Obsidian Publish: Improve 404 handling with helpful redirect

Use case or problem

The nature of a digital garden is that it is fluid: Note names get changed and files get moved. Pairing that with Obsidian Publish results in a lot of broken links which makes it pretty unsatisfying for visitors.

Currently, the 404 page looks like this:

Proposed solution

To make the user experience better, search results could be displayed to the user for the missing page.

Say, I link to the note Slipbox/Obsidian. Then I move it to Tools/Obsidian → The link is broken even if the file name hasn’t even changed. It would be great to display a handful of search results for “Obsidian” on the 404 page. Most broken links could be remedied, or at least the visitor is redirected to similar pages.

4 Likes

I don’t understand this. If you move files, obsidian publish gui should tell you that a file was deleted in Slipbox/Obsidian and a file was created in Tools/Obsidian.

The obsidian publish “deleted” and “created” process is where the vault owner becomes aware that links become broken, but it doesn’t resolve the fact that while that file was online it was at one address, and (after the vault owner reorganized) all mentions of that address on the internet are useless.

I believe the suggestion is that broken links can be more useful than they are. The anticipated page title could be fed into search so that the user can find relevant pages. Or perhaps to the nears alphabetical match in other directories. I am not sure what the best/easiest solution to implement, but I understand that the request is regarding already publicized links (that one may be unwilling or unable to edit) to notes that may have been relocated or simply deleted.

(I would also be happy with a redirect to the homepage, since then the user can search manually)

Ok, so the problem is about broken links that visitors may have because they used an old link and the vault structure has changed in the meantime.

The 404 error is correct. I agree that augmenting it with search results would be an improvement. I find a straight redirect to a same named note somewhere else a bit dangerous and potentially misleading.

Yes, I believe so. And yes, the 404 is expected behavior no doubt.

I agree that a straight redirect should not be enabled by default, but rather an option. For some people who have pasted their links hundreds or thousands of places, that one toggle could save them weeks of work in updating those links. The redirect-to-search would be better than nothing, and certainly less problematic in general.

Yes, totally agree. Might have been a bit unclear on that initially.

I’d suggest two improvements:

Display the name of the note that was searched for
eg. “File Slipbox/Obsidian not found”. It is nice to tell users what they actually tried to find.

List search results in the 404 page/redirect to search.
Eg: These notes might be interesting to you:

  • Tools/Obsidian
  • Obsidian Publish
  • Obsidian MOC

That way, the 404 page lists the note the user was searching for, or leads them to further exploration in the published notes.

+1 for a 404 showing search results for the filename.

It would be even better if we could customise the 404 page.
This could be achieved by having an embed to an existing page in the vault. Like we do for the start page.
Then any 404 would display a custom note in the vault eg. ‘404.md’ followed by the search results.

What do you think?

2 Likes

Use case or problem

I have lots of “literature notes”, where I write about a certain published work. However, in lots of existing notes, I would mention these published works even though I haven’t written about them. I would use an internal link such as [[LiteratureA]] to mention them, hoping that at some point they become existing notes.

Now, in the viewing mode, or on the website where I use Obsidian Publish to publish the vault, when a page is not created yet, I hope that, instead of showing that the page does not exist, I could click on it and go to the URL that connects me to the literature.

Proposed solution

Something like this might work: [[LiteratureA]][someurl]. I.e. in the viewing mode, if the note [[LiteratureA]] exists, when I can click on it and go to the page, but if it does not exist, clicking on it takes me to the URL.

As a less smooth workaround you could just create the note and put the url in it.