Custom 404 Template

Highlighted
Excursionist
24 2 6

To preserve the original files my plan is to create custom templates to have any templates or sections that I edit as a custom file.  I understand that for products or pages you can go to that page in the Admin and change the template to be used, but for other pages such as the 404 Page there is no place to specify the custom page template.  So the question is how do I go about using custom templates for pages that don't have a real corresponding Admin page?

Thanks,
Mike
0 Likes
Highlighted
Shopify Partner
1079 171 198

Hi Mike!

You can create a section calling it '404-section' then add this {% section '404-section' %} inside the 404.liquid template and it will show up on the Theme Editor. You can also manually change the code the way you want to and always revert back to the original liquid file should you need to return back to it. 

- Did we solve your issue? Like & Mark As Solution to help the community
- Should you need any direct help: contact@jhkcreate.com
K&J
0 Likes
Excursionist
24 2 6

 JHKC,

Not sure that is going to work here.  Honestly I am new to Shopify and the Liquid code model so maybe I just dont understand your response.  Here is a bit more detail.

1. I have created a custom Layout file named 404-layout.liquid
2. I created a custom template named 404.alternate.liquid
3. I cared a custom section named custom-404.liquid.

The Layout file removed the footer and sets up the page to use the full height.

The template file has just 2 lines, one to state which layout to use ({% layout "404-layout" %}) and one to call the section ({% section 'custom-404' %}).

Now if I set the stock 404.liquid file back to its default code, that is what shows when I force a 404 error by going to a page that does not exist.  There is no place I can find to specify anywhere to use the 404.alternate.liquid template.

The only way I can get my custom 404 page content to show is by changing the content of the 404.liquid template.

 

Thanks,
Mike
0 Likes