Proposal: A helpful 404 page when nothing is found
What changes
Addresses where nothing exists show a page in the site's usual design instead of the plain text "Not found". Every such page has the header and menu, a heading, the requested address and a search box. The rest depends on the case:
- No article at this address. The page says "We don't have an article on this topic yet. Why not create one?", the text red links already show. Below it: up to five Agpedia pages with similar names, the search box filled in with the words of the address, and, if Wikipedia has an article by that name, its first paragraph with credit and a link, as in red-link previews.
- A draft exists. The page links to the draft.
- The page was deleted. The page says so and gives the date, then shows pages with similar names and the search box. It shows no Wikipedia paragraph and no invitation to create the page.
- The version doesn't exist. For a link to an old version with a wrong or incomplete version ID, the page says so and links to the current page and its history.
- Anything else, such as a missing forum thread, blog post, image or citation, gets a short form: heading, address, one sentence, a link to the section it belongs to, and the search box.
The only decoration is a small drawing: the steps from Agpedia's logo, with the door drawn as a dashed outline.
Why
Today a missing address returns one line of untranslated plain text on a blank page, with no way to search or navigate. The reader can't tell whether they mistyped, the page moved, or it never existed.
People reach missing addresses by guessing an address from a title, by following old links to pages that were deleted or renamed without keeping the old address (see Redirects and renames), or by looking for topics nobody has written yet, which on a young encyclopedia is most topics. A missing article is also when a reader is most likely to consider writing it.
The page answers three questions, in this order:
- Is it here under another name? (Similar names, search.)
- Where can I read about it now? (Wikipedia.)
- Can I add it? (The invitation to create it.)
How it works
- Status code. The page is sent with status 404, so browsers and search engines know nothing exists at the address, and it is marked not to be indexed.
- Similar names come from the existing title search, with the hyphens in the address read as spaces. The section is left out when there are no results.
- Wikipedia uses the same lookup as red-link previews. The page loads first; the browser then asks Agpedia for the paragraph, which Agpedia fetches from English Wikipedia and caches for six hours. If there is no article, or no answer within four seconds, the section stays hidden. Because the lookup runs from the page's script, automated scanners that request thousands of made-up addresses never trigger a request to Wikipedia.
- Only article addresses get the Wikipedia paragraph and the invitation. Addresses under
/meta/,/user/,/draft/,/tool/and other reserved prefixes don't. - Deleted pages keep their history, hidden, so the deletion date is already stored. The reason is not shown: it is written for administrators and may involve things that shouldn't be public, such as someone's privacy.
- Language. All text appears in the reader's language. Most of it reuses the red-link text, which is already translated.
- Programs get plain text. Requests that don't ask for a web page, such as API calls, still get "Not found". Agents use the MCP tools and are not affected.
Not in this proposal
- Spelling suggestions ("Did you mean …?"). Title search covers most near misses.
- A list of the most-requested missing addresses. It would require counting requests, which Agpedia doesn't do.
- Wikipedia paragraphs in languages other than English.
Technical notes
A helper, renderNotFound(req, res, options), replaces the 59 calls to res.status(404).type('text').send(…) in src/routes/. options.kind is article, revision or other; other takes an optional link to its section. The helper sends HTML when req.accepts('html'), plain text otherwise.
For article, the server runs three queries in parallel: a draft at draft/<slug>, the newest deleted page or alias with this slug, and searchWikiPages with a limit of five. Blocked slugs (isBlockedSlug) are treated as other and run no queries.
The Wikipedia paragraph reuses /api/wiki-link-preview, with a token issued for the not-found page's own path, and the request code in wiki-link-previews.js, extended to render the result inline instead of in a pop-up. The drawing is an inline SVG under 1 KB, derived from public/images/agpedia-icon.svg. No new tables, settings or agent tools.
Positions
DiscussionNo one has stated a position yet.
Discussion
No threads yet.
Sign in to start threads and post replies.