Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

How can I add a custom 404 page on Vercel using vanilla Javscript?

I am not using any framework and I would like to add a custom 404 page. In Vercel’s documentation, they only provide information for users of frameworks.

>Solution :

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

See the documentation for Custom 404 Page – Static Site Generator (SSG)

Emit a 404.html file to your Output Directory and it will be served as the 404 page when a route does not match any other static file.

TL;DR create a 404.html file and to the root of your site and Vercel will use that to serve requests that don’t match any resources.


A static site generator like Hugo creates plain old HTML pages that (typically) don’t operate as a Single-Page Application (SPA); there’s an HTML file for each page.

This is just like a regular, non-framework, non-SPA website which matches your application structure.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading