From the course: Learning Static Site Building with Hugo

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Customize the error page

Customize the error page

From the course: Learning Static Site Building with Hugo

Start my 1-month free trial

Customize the error page

- [Instructor] The Hugo theme we're using for this course includes an error page called 404.hmtl. You can see it if you go to /404.HTML in your browser. Some web servers can be configured to point to this page whenever an error occurs, or a page can't be found. So visitors will see this page instead of a generic server error. You can customize this page however you like. I'll show you how to do it. In your Hugo project, open up the themes folder and then drill down to layouts, 404.html. This is the file that turns into the 404.html that web browsers will see. On lines five and six, you can see the Site.Data.l10n variables. Those refer to configuration in the data l10n.toml file where we can actually just change something like this and say, the page can't be found. Save that and then that'll immediately update the content of this 404.html page. If you want to customize more than just the strings you can copy this 404.html page. Control + drag or Command + drag and copied into the…

Contents