Wiki source code of Error Pages
Last modified by superadmin on 2026/12/04 14:24
Show last authors
| author | version | line-number | content |
|---|---|---|---|
| 1 | The screen a reader gets when a page, an attachment or an entire wiki does not exist, or when access is denied, comes from a Velocity template: three of them are shipped with the web application, and the missing-page one with the [[Flamingo skin>>doc:extensions:Extension.Flamingo Skin]]. None of the four wiki pages they look for first ships, which is why a new instance always shows the standard screen. | ||
| 2 | |||
| 3 | [[Customize an Error Page>>doc:documentation.xs.admin.page.error-pages.customize.WebHome]] gives the four page names, the wiki each one has to be created in, and the HTTP status of each case. | ||
| 4 | |||
| 5 | == Why a wiki page rather than the template == | ||
| 6 | |||
| 7 | Editing the templates works, but they belong to two different artifacts (the missing-page one to the skin, the other three to the web application), so every upgrade brings new versions of them to merge. A wiki page is yours: an upgrade has nothing to merge into it. | ||
| 8 | |||
| 9 | == What a custom page takes away == | ||
| 10 | |||
| 11 | The template includes your page //instead of// its standard block, not in addition to it. On a missing page, that block is more than a message: | ||
| 12 | |||
| 13 | {{image reference="standard-missing-page.png" size="large" alt="The standard notice on a page that does not exist, with the create link and the suggestions of similar pages"/}} | ||
| 14 | |||
| 15 | A custom ##XWiki.DocumentDoesNotExist## therefore also removes the "edit this page" link that lets a reader create the page, the suggestions of similar pages (contributed by a shipped user interface extension that hands the search over to the search engine, Solr on a standard instance), and the list of matching pages waiting in the recycle bin. The same holds for the other cases: a custom attachment page drops the extensions contributed to that screen, and a custom access-denied page drops both the underlying error and the distinction between "this wiki is read-only" and "you are not allowed". Whatever of that your readers need, your page has to offer itself. | ||
| 16 | |||
| 17 | == One page for two situations == | ||
| 18 | |||
| 19 | ##XWiki.DocumentDoesNotExist## answers both the reader who opens a page that does not exist and the far rarer case of a Velocity template that cannot be evaluated. The second is an internal error rather than a missing page, so a message written only for readers looking for content reads oddly there. |