1
0
Fork 0
hugo/docs/content/en/templates/404.md

2.2 KiB

title linkTitle description categories keywords weight
Custom 404 page 404 templates Create a template to render a 404 error page.
190

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:

{{ define "main" }}
  <h1>404 Not Found</h1>
  <p>The page you requested cannot be found.</p>
  <p>
    <a href="{{ .Site.Home.RelPermalink }}">
      Return to the home page
    </a>
  </p>
{{ end }}

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.