Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs(v2): localize 404 page with Netlify + docs #4178

Merged
merged 1 commit into from
Feb 4, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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