Custom layout for an HTML page


I’m having a bit of trouble with custom layouts.

I have a 404.html in my layouts folder and with that page, I want to remove the navbar and footer to allow the 404 page to take up the entire screen. I’ve been looking at the template lookup order, and saw you can easily call specific layouts in the frontmatter when you’re dealing with a Markdown page. However, since the 404 is an HTML page, how do you make it call a specific layout? I was able to get it working temporarily by testing out creating a single.html and list.html in the _default folder, but then my index.html (main landing page) took the custom layout too and the navbar and footer disappeared from the page. I only want the 404.html to take on the custom layout.

Any ideas would be appreciated! Thanks!

Read through this if you haven’t:

I am able to see my custom design by going to localhost:1313/404.html, my problem is that these pages still call a base template that inserts the navbar and footer partials.

If I make a custom layout that removes those two partials, then it applies both to my 404.html and my index.html, which I don’t want. I only want it to apply to the 404.html.

Ah, are you defining your 404 template with define "main" ? or are you using a fully valid html layout in it? (meaning would be a valid webpage without any other layouts)?

without knowing for certain, I would expect a fully specified html page (no define, just a self-contained html page) would work.


Ahh, I see what you mean!!

I had an issue before where removing the define "main" caused the removal of all the page formatting, but I see now that by adding a bit more of the HTML (doctype, proprietary head), I’m getting the results I was looking for without actually needing any layout templates.


This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.