Friendlier 404 for unknown page slugs
Page URLs come from page names, and hot reloading means slugs can change while the server is running. After renaming a page I loaded the old URL and got Go's default plain-text 404 page not found.
Since the response is unstyled, it isn't obvious that Glance itself is still running. I initially assumed a config error and went to check the container logs. I rearrange my pages fairly often, so I run into this through stale bookmarks and open tabs.
Two options:
- A themed 404 view that says the page doesn't exist and lists the configured pages.
- Redirect unknown slugs to the default page. This needs no configuration, though it could be a server option like
server: { not-found: redirect | 404 }if the distinction matters.
Downsides are minimal: a redirect hides typos, and a 404 view is one more template to maintain.
Prior art: #119 added a styled 404 page but was closed unmerged. Most dashboard apps redirect unknown routes to the root.
Happy to implement this against dev if the idea is welcome.
Source: glanceapp/glance