Search code examples
docusaurus

How do I customise the 404 page?


I would like to know how to change the text on the 404 page to be custom not the generic message. How would I go about this? The standard 404 page looks like this.


Solution

  • You need to swizzle it.

    1) Open a Terminal/Power Shell inside your docusaurus folder.

    2) Run:

    npm run swizzle @docusaurus/theme-classic NotFound
    

    3) Edit the file src/theme/NotFound.js.


    Reference: https://github.com/facebook/docusaurus/discussions/6030