sveltejs / sveltejs/kit

Improve the docs on 404 pages for unknown routes

Open
#12,569 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

documentation
Dominant language
JavaScript
Stars
20.8k
Forks
2.3k
Avg merge
1d 16h
Merged PRs (30d)
156

Description

Describe the problem

When looking up information on how 404s work for unknown routes, I ended up reading the docs about +error.svelte. There it says:

If no route can be found (404), src/routes/+error.svelte (or the default error page, if that file does not exist) will be used.

This made me believe you couldn't have different 404 pages for different unknown routes, so I stopped looking for more information.

But later I (by accident) stumbled upon the docs about 404 pages, where they explain how you can "turn unknown routes into known routes using rest parameters", so it is indeed possible to have different 404 pages for "unknown routes", but I read the docs as it wasn't possible, and therefore I stopped looking for such a solution, and missed it.

Describe the proposed solution

I propose the docs about +error.svelte also contains a link to the docs about 404 pages. The following part:

If no route can be found (404), src/routes/+error.svelte (or the default error page, if that file does not exist) will be used.

Could for example be:

If no route can be found (404), src/routes/+error.svelte (or the default error page, if that file does not exist) will be used. If you need to use different error pages for different unknown routes, see 404 pages.

Alternatives considered

No response

Importance

nice to have

Additional Information

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the +error.svelte documentation section and compare it with the 404 pages section. Add a cross-link explaining how different pages for unknown routes work, then verify the wording and documentation links in the docs preview or build.

Written by the indexing model from the issue text.

Assessment

Domain
documentation
Issue type
Documentation
Difficulty
1/5
Estimated time
Under an hour
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.