statamic / ssg

The official Statamic Static Site Generator
234 stars 24 forks source link

Automatically generate 404.html if a custom 404 view exists #33

Closed jesseleite closed 3 years ago

jesseleite commented 4 years ago

Right now to get a custom 404 page on netlify we had to...

1) Create a _redirects file in your project that references a fake 404 page (see docs)...

    /* /not-found 404

2) Create a custom laravel 404 view at resources/views/errors/404.antlers.html 3) Map a route for it Route::statamic('not-found', 'errors/404') 4) Add /not-found to urls in your ssg config 5) Add base_path('_redirects') => '_redirects' to copy in your ssg config

It looks like netlify will use 404.html if it exists, so maybe we could automatically detect if a custom 404 view exists and generate that to 404.html.