mirror of
https://github.com/gohugoio/hugo.git
synced 2025-09-01 22:42:45 +02:00
Merge commit '5be51ac3db225d5df501ed1fa1499c41d97dbf65'
This commit is contained in:
@@ -2,18 +2,14 @@
|
||||
title: Custom 404 page
|
||||
linkTitle: 404 templates
|
||||
description: Create a template to render a 404 error page.
|
||||
categories: [templates]
|
||||
categories: []
|
||||
keywords: []
|
||||
menu:
|
||||
docs:
|
||||
parent: templates
|
||||
weight: 160
|
||||
weight: 160
|
||||
weight: 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:
|
||||
|
||||
{{< code file=layouts/404.html >}}
|
||||
```go-html-template {file="layouts/404.html"}
|
||||
{{ define "main" }}
|
||||
<h1>404 Not Found</h1>
|
||||
<p>The page you requested cannot be found.</p>
|
||||
@@ -23,7 +19,7 @@ To render a 404 error page in the root of your site, create a 404 template in th
|
||||
</a>
|
||||
</p>
|
||||
{{ end }}
|
||||
{{< /code >}}
|
||||
```
|
||||
|
||||
For multilingual sites, add the language key to the file name:
|
||||
|
||||
|
Reference in New Issue
Block a user