hugo/docs/content/en/templates/404.md
2024-08-09 15:17:43 +02:00

2.2 KiB

title linkTitle description categories keywords menu weight
Custom 404 page 404 templates Create a template to render a 404 error page.
templates
docs
parent weight
templates 160
160

To render a 404 error page in the root of your site, create a 404 template in the root of the layouts directory. For example:

{{< code file=layouts/404.html >}} {{ define "main" }}

404 Not Found

The page you requested cannot be found.

Return to the home page

{{ end }} {{< /code >}}

For multilingual sites, add the language key to the file name:

layouts/
├── 404.de.html
├── 404.en.html
└── 404.fr.html

Your production server redirects the browser to the 404 page when a page is not found. Capabilities and configuration vary by host.

Host Capabilities and configuration
Amazon CloudFront See details.
Amazon S3 See details.
Apache See details.
Azure Static Web Apps See details.
Azure Storage See details.
Caddy See details.
Cloudflare Pages See details.
DigitalOcean App Platform See details.
Firebase See details.
GitHub Pages Redirection to is automatic and not configurable.
GitLab Pages See details.
NGINX See details.
Netlify See details.