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

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, 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.

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 -->
	<!-- 404 stuff -->

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

Thank you for your amazing work here.

Well you could create a headless bundle (Page bundle with headless parameter set to true) to which you would assigne content/Params etc…

And then fetch it from the 404.html

# content/404/
title: 404
headless: true
Something to talk about
{{*/ 404.html /*}}
{{ with site.GetPage "/404" }}
{{ .Content }}
{{ end }}