Improved Publish 404 handling

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.

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

1 Like