Skip to content

Commit

Permalink
localize 404 page
Browse files Browse the repository at this point in the history
  • Loading branch information
slorber committed Feb 4, 2021
1 parent 6af8fbb commit 8fdf2e9
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
19 changes: 19 additions & 0 deletions website/docs/i18n/i18n-tutorial.md
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,16 @@ The Docusaurus v2 website use this strategy:

:::

:::tip

Static hosting providers generally redirect `/unknown/urls` to `/404.html` by convention, always showing an **English 404 page**.

**Localize your 404 pages** by configuring your host to redirect `/fr/*` to `/fr/404.html`.

This is not always possible, and depends on your host: GitHub Pages can't do this, [Netlify](https://docs.netlify.com/routing/redirects/redirect-options/#custom-404-page-handling) can.

:::

### Multi-domain deployment

You can also build your site for a single locale:
Expand All @@ -283,3 +293,12 @@ On your [static hosting provider](../deployment.mdx):
This strategy is **not possible** with Github Pages, as it is only possible to **have a single deployment**.

:::

### Hybrid

It is possible to have some locales using sub-paths, and others using subdomains.

It is also possible to deploy each locale as a separate subdomain, assemble the subdomains in a single unified domain at the CDN level:

- Deploy your site as `fr.docusaurus.io`
- Configure a CDN to serve it from `docusaurus.io/fr`
4 changes: 4 additions & 0 deletions website/static/_redirects
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,8 @@
/classic/blog/2020/01/19/docusaurus-2020-recap /classic/blog/2021/01/19/docusaurus-2020-recap


# Redirect each country sub-path to appropriate localized 404 file
# See https://docs.netlify.com/routing/redirects/redirect-options/#custom-404-page-handling
/fr/* /fr/404.html 404


0 comments on commit 8fdf2e9

Please sign in to comment.