vitepress
vitepress copied to clipboard
Even after adding a custom 404.md, the standard 404 page is displayed.
Describe the bug
I am creating documentation using VitePress. To display a custom 404 page, I added a 404.md file. However, after building the project, the standard 404 page is displayed instead.
Here is the reproduction environment: https://stackblitz.com/edit/vite-pukdjm?file=docs%2F404.md
Accessing /404.html
displays the custom 404 page. However, when accessing non-existent paths such as /foo.html
, the standard 404 page appears instead (the custom 404 page is briefly displayed, but then seems to get replaced).
How can I ensure that the custom 404 page is displayed when accessing non-existent paths?
Reproduction
https://stackblitz.com/edit/vite-pukdjm?file=docs%2F404.md
Expected behavior
custom 404.md page is displayed.
System Info
System:
OS: macOS 14.4
CPU: (8) arm64 Apple M2
Memory: 93.02 MB / 24.00 GB
Shell: 5.9 - /bin/zsh
Binaries:
Node: 18.18.2 - ~/.asdf/installs/nodejs/18.18.2/bin/node
Yarn: 1.22.19 - ~/.asdf/installs/nodejs/18.18.2/bin/yarn
npm: 10.2.5 - ~/.asdf/plugins/nodejs/shims/npm
pnpm: 8.12.0 - ~/.asdf/installs/nodejs/18.18.2/bin/pnpm
bun: 1.0.29 - /opt/homebrew/bin/bun
Browsers:
Chrome: 124.0.6367.201
Edge: 124.0.2478.97
Safari: 17.4
Additional context
No response
Validations
- [X] Check if you're on the latest VitePress version.
- [X] Follow our Code of Conduct
- [X] Read the docs.
- [X] Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
ref https://github.com/vuejs/vitepress/discussions/3880