Define 404 page content in an .md file under the content/ directory


#21

Params aside, I’m trying to specify the content of a 404, but couldn’t. I tried everything suggested here, and somewhere else too.

These posts are just 4 months old so I don’t know if anything changed or I’m doing anything wrong. @nop33 mention following https://gohugo.io/templates/404/, but I can’t see anything there.

To be clear: what I’d like to specify a markdown file and end up with a standard 404.html file that contains its content.


#22

Hi there,

I’ve been encountering a similar problem with my layouts/404.html page, which indeed does not seem to be treated like a normal page altogether, not even like a node or anything – just like no other page.
In layouts/404.html I include a <head> that I take with {{ partial head.html . }} but it does not seem to even communicate .Site variables; hence variables such as .Site.Title are not present for the 404 page. As a guard, I simply include:

{{if or (or .IsHome .IsPage) .IsNode}}
	<!-- non-404 stuff -->
{{else}}
	<!-- 404 stuff -->
{{end}}

It is possible I’m missing something, but it has been working great so far.

Thank you for your amazing work here.
S.