Docusaurus: How to create /404.html?

Created on 16 Dec 2017  路  3Comments  路  Source: facebook/docusaurus

Is this a bug report?

Yes, or feature request.

GItHub pages and Netlify treat 404.html as special url.

Current docusaurus can not output /404.html.

Have you read the Contributing Guidelines?

Yes

Environment

  • OS: macOS 10.12.6
  • Node: v9.2.1
  • npm: 5.5.1
  • docusaurus: 1.0.3

Steps to Reproduce

  1. Create /website/pages/404.js
  2. Put following content
const React = require("react");
class Index extends React.Component {
    render() {
        return <div>>404</div>;
    }
}
module.exports = Index;
  1. npm run build

Throw following error:

/Users/azu/.ghq/github.com/almin/almin/website/node_modules/docusaurus/lib/server/generate.js:360
      var langParts = match[1].split('/');
                           ^

TypeError: Cannot read property '1' of null
    at /Users/azu/.ghq/github.com/almin/almin/website/node_modules/docusaurus/lib/server/generate.js:422:25
    at Array.forEach (<anonymous>)
    at execute (/Users/azu/.ghq/github.com/almin/almin/website/node_modules/docusaurus/lib/server/generate.js:401:9)
    at Object.<anonymous> (/Users/azu/.ghq/github.com/almin/almin/website/node_modules/docusaurus/lib/build-files.js:31:1)
    at Module._compile (module.js:641:30)
    at Object.Module._extensions..js (module.js:652:10)
    at Module.load (module.js:560:32)
    at tryModuleLoad (module.js:503:12)
    at Function.Module._load (module.js:495:3)
    at Function.Module.runMain (module.js:682:10)

Expected Behavior

Create build/<site>/404.html

Actual Behavior

Throw error.

TypeError: Cannot read property '1' of null

Most helpful comment

@azu Thank you for the detailed issue description.

Another option is to put a raw HTML page (e.g., 404.html) into the website/static directory as well. And that file will get copied over to the root of the site upon build/generation.

All 3 comments

Ah, I've noticed that docusaurus create from en/404.js to build/<site>/404.html if default lang is en.

404 js almin 2017-12-16 22-43-32

This issue has been resolved. I'm close this issue.

@azu Thank you for the detailed issue description.

Another option is to put a raw HTML page (e.g., 404.html) into the website/static directory as well. And that file will get copied over to the root of the site upon build/generation.

bo teta de resolver:
crie o arquivo 404.js nas pages
copie e cole o conteudo do help.js
build e seja feliz

Was this page helpful?
0 / 5 - 0 ratings

Related issues

chandankumar4 picture chandankumar4  路  3Comments

NikitaIT picture NikitaIT  路  3Comments

JoelMarcey picture JoelMarcey  路  3Comments

nebrelbug picture nebrelbug  路  3Comments

itelofilho picture itelofilho  路  3Comments