Why does my 404 page look so different from my other pages?

It looks as if the 404 page hasn’t picked up the theme. Is that normal? Is it fixable?

Your theme doesn’t specify a 404 template so it falls back to a blank one. You could make one.

1 Like

Thanks Jason

I’m going to need some help doing that. The documentation is quite spare. Can you point me at anything more complete?

I created a layouts/404.html template in the theme (and copied the code for the template from another theme with a 404 page) but it doesn’t appear to do anything.

I don’t fully understand where the actual 404 page gets its CSS from… clearly not from the CSS file in the theme.

Your template will need to define main (to use the baseof template) or include the CSS directly.

There’s also a trick to create simple 404 pages without needing to use Hugo. Click on Pages on the web and create a new page called exactly “404”. Micro.blog will use that for the 404 not found page.

Note that Micro.blog caches 404 pages for about an hour, so it might take that long for changes to be reflected on your blog.

Using a Hugo template will give you the most control, but if you just want a custom message and default CSS, using the 404 page trick will work.

Oh that’s a good trick.

This works really well for my purposes.