Skip to content

Commit e3ae349

Browse files
authored
docs(v2): localize 404 page with Netlify + docs (#4178)
1 parent 6af8fbb commit e3ae349

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed

website/docs/i18n/i18n-tutorial.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,16 @@ The Docusaurus v2 website use this strategy:
262262

263263
:::
264264

265+
:::tip
266+
267+
Static hosting providers generally redirect `/unknown/urls` to `/404.html` by convention, always showing an **English 404 page**.
268+
269+
**Localize your 404 pages** by configuring your host to redirect `/fr/*` to `/fr/404.html`.
270+
271+
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.
272+
273+
:::
274+
265275
### Multi-domain deployment
266276

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

285295
:::
296+
297+
### Hybrid
298+
299+
It is possible to have some locales using sub-paths, and others using subdomains.
300+
301+
It is also possible to deploy each locale as a separate subdomain, assemble the subdomains in a single unified domain at the CDN level:
302+
303+
- Deploy your site as `fr.docusaurus.io`
304+
- Configure a CDN to serve it from `docusaurus.io/fr`

website/static/_redirects

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,8 @@
55
/classic/blog/2020/01/19/docusaurus-2020-recap /classic/blog/2021/01/19/docusaurus-2020-recap
66

77

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

0 commit comments

Comments
 (0)