|
1 | 1 | --- |
2 | | -title: Adding a 404 Page |
| 2 | +title: 404ページを追加する |
3 | 3 | --- |
4 | 4 |
|
5 | | -To create a 404 page create a page whose path matches the regex |
6 | | -`^\/?404\/?$` (`/404/`, `/404`, `404/` or `404`). Most often you'll want to create a React component page at |
7 | | -`src/pages/404.js`. |
| 5 | +404 ページは、パスの正規表現が `^\/?404\/?$`(`/404/`、`/404`、`404/`、もしくは `404`)に一致するページです。 |
| 6 | +ほとんどの場合あなたは、作りたい React コンポーネントページを `src/pages/404.js` に作成します。 |
8 | 7 |
|
9 | | -Gatsby ensures that your 404 page is built as `404.html` as many static hosting |
10 | | -platforms default to using this as your 404 error page. If you're hosting your |
11 | | -site another way, you'll need to set up a custom rule to serve this file for 404 |
12 | | -errors. |
| 8 | +一般的な静的ホスティングプラットフォームが 404 エラーページとして使っている `404.html` と同様に、Gatsby は 404 ページをビルドします。 |
| 9 | +もしあなたが Gatsby 以外の方法でサイトをホストしている場合は、404 エラーに対してこのファイルが返されるようカスタムルールを設定する必要があるでしょう。 |
13 | 10 |
|
14 | | -Because Gatsby creates this page for you by default, there is no need to configure |
15 | | -it in your `gatsby-node.js` file. |
| 11 | +Gatsby は初期設定でこのページを自動的に作成するため、`gatsby-node.js` であらためて設定する必要はありません。 |
16 | 12 |
|
17 | | -When developing using `gatsby develop`, Gatsby uses a default 404 page that |
18 | | -overrides your custom 404 page. However, you can still preview your 404 page by |
19 | | -clicking "Preview custom 404 page" to verify that it's working as expected. This is |
20 | | -useful when you're developing so that you can see all the available pages. |
| 13 | +`gatsby develop` を使って開発しているときは、Gatsby はあなたの作成した 404 ページではなくデフォルト 404 ページを優先して表示します。 |
| 14 | +ここで、「Preview custom 404 page」をクリックすることであなたが作成した 404 ページをプレビューでき、思ったとおりに動作しているかを確認できます。 |
| 15 | +ここで、使用可能なすべてのページを確認できるため開発しているときに便利です。 |
21 | 16 |
|
22 | | -The screenshot below shows the default 404 page that Gatsby creates. |
23 | | -It also lists out all the pages on your website. Clicking the "Preview custom 404 |
24 | | -page" button will allow you to view the 404 page you created. |
25 | | - |
| 17 | +次のスクリーンショットは、Gatsby が自動的に生成するデフォルト 404 ページです。 |
| 18 | +また、ここにはあなたの作成したすべてのページが一覧で表示されます。 |
| 19 | +「Preview custom 404 page」ボタンをクリックすると、あなたの作成した 404 ページが表示されます。 |
| 20 | + |
26 | 21 |
|
27 | | -The screenshot below shows the custom 404 page. |
28 | | - |
| 22 | +次のスクリーンショットはカスタム 404 ページです。 |
| 23 | + |
0 commit comments