Allow serving custom error page (#393)

It might be useful for those self-hosting a Codeberg Pages instance to be able to serve a different error page than the one embedded with go:embed

Reviewed-on: https://codeberg.org/Codeberg/pages-server/pulls/393
Co-authored-by: Gnarwhal <git.aspect893@passmail.net>
Co-committed-by: Gnarwhal <git.aspect893@passmail.net>
This commit is contained in:
Gnarwhal 2024-11-17 16:28:52 +00:00 committed by crapStone
parent bef866faae
commit 23a8e83e80
3 changed files with 33 additions and 6 deletions

View file

@ -84,6 +84,15 @@ This will trigger a build of the PR which will build a docker image to be used f
- `PAGES_DOMAIN` (default: `codeberg.page`): main domain for pages.
- `RAW_DOMAIN` (default: `raw.codeberg.page`): domain for raw resources (must be subdomain of `PAGES_DOMAIN`).
### Custom Error Page
A custom error page template can be served by creating `custom/error.html`.
Data available to the template includes:
- `{{ .StatusCode }}`: The HTTP status code (e.g. 404)
- `{{ .StatusText }}`: The textual name associated with the status code (e.g. Not Found)
- `{{ .Message }}`: The reason for the error
## Contributing to the development
The Codeberg team is very open to your contribution.