From 4de37284d27ae90a02dead6205dd08d1affb01d4 Mon Sep 17 00:00:00 2001 From: fhiromasa <74556046+fhiromasa@users.noreply.github.com> Date: Thu, 29 Feb 2024 16:50:30 +0900 Subject: [PATCH 01/11] Update routing.mdx in ja Modified to be similar to the English sample code in "Nested Pagination" section --- src/content/docs/ja/guides/routing.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/content/docs/ja/guides/routing.mdx b/src/content/docs/ja/guides/routing.mdx index b7a5f5448ffe1..428b372f15228 100644 --- a/src/content/docs/ja/guides/routing.mdx +++ b/src/content/docs/ja/guides/routing.mdx @@ -439,7 +439,7 @@ export function getStaticPaths({paginate}) { // すべてのタグに対して、paginate()の結果を返します。 // その結果がどのタググループに対するものかAstroに伝えるために、 // `{params: {tag}}`を必ず`paginate()`に渡してください。 - return allTags.map((tag) => { + return allTags.flatMap((tag) => { const filteredPosts = allPosts.filter((post) => post.frontmatter.tag === tag); return paginate(filteredPosts, { params: { tag }, From bcdb0427f641d08b69431293f10144ce4777bd9f Mon Sep 17 00:00:00 2001 From: fhiromasa <74556046+fhiromasa@users.noreply.github.com> Date: Sun, 3 Mar 2024 15:13:35 +0900 Subject: [PATCH 02/11] update routing.mdx in ja [code-example-syntax] hippo-proof code examples (#5364) --- src/content/docs/ja/guides/routing.mdx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/content/docs/ja/guides/routing.mdx b/src/content/docs/ja/guides/routing.mdx index 428b372f15228..c5859f627a419 100644 --- a/src/content/docs/ja/guides/routing.mdx +++ b/src/content/docs/ja/guides/routing.mdx @@ -331,7 +331,7 @@ Astroは、複数のページに分割する必要がある大規模なデータ ```astro /{ (paginate) }/ /paginate\\(.*\\)/ /(?<=const.*)(page)/ /page\\.[a-zA-Z]+/ --- -// 例: /src/pages/astronauts/[page].astro +// src/pages/astronauts/[page].astro export async function getStaticPaths({ paginate }) { const astronautPages = [{ astronaut: 'ニール・アームストロング', @@ -371,7 +371,7 @@ const { page } = Astro.props; ```astro /(?<=const.*)(page)/ /page\\.[a-zA-Z]+(?:\\.(?:prev|next))?/ --- -// 例: /src/pages/astronauts/[page].astro +// src/pages/astronauts/[page].astro // 前の例と同じように、{ astronaut } オブジェクトのリストをページネーションします export async function getStaticPaths({ paginate }) { /* ... */ } const { page } = Astro.props; @@ -432,7 +432,7 @@ interface Page { ```astro /(?:[(]|=== )(tag)/ "params: { tag }" /const [{ ]*(page|params)/ --- -// 例: /src/pages/[tag]/[page].astro +// src/pages/[tag]/[page].astro export function getStaticPaths({paginate}) { const allTags = ['red', 'blue', 'green']; const allPosts = await Astro.glob('../../posts/*.md'); From 0e36aea5f4224e5978f4444f480b576fbead4a59 Mon Sep 17 00:00:00 2001 From: fhiromasa <74556046+fhiromasa@users.noreply.github.com> Date: Sun, 3 Mar 2024 15:18:36 +0900 Subject: [PATCH 03/11] update routing.mdx in ja fix: add spacing to 'added in' texts (#5765) --- src/content/docs/ja/guides/routing.mdx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/content/docs/ja/guides/routing.mdx b/src/content/docs/ja/guides/routing.mdx index c5859f627a419..990b7724e4827 100644 --- a/src/content/docs/ja/guides/routing.mdx +++ b/src/content/docs/ja/guides/routing.mdx @@ -231,7 +231,8 @@ const { title, text } = page; Astroの設定で、[永久的に移動したページにユーザーをリダイレクト](#リダイレクトの設定)するルールを定義できます。また、ユーザーがサイトを利用した際に[動的にリダイレクト](#動的リダイレクト)することもできます。 ### リダイレクトの設定 - + +

`redirects`値を使用して、Astroの設定から永久的なリダイレクトのマッピングを指定できます。ほとんどのリダイレクトでは、これは古いルートから新しいルートへのマッピングとなります。 From 718dcb74f9a61c42fbd157b611aac083e544d5e2 Mon Sep 17 00:00:00 2001 From: fhiromasa <74556046+fhiromasa@users.noreply.github.com> Date: Sun, 3 Mar 2024 15:24:45 +0900 Subject: [PATCH 04/11] update routing.mdx in ja Add component (#6267) --- src/content/docs/ja/guides/routing.mdx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/content/docs/ja/guides/routing.mdx b/src/content/docs/ja/guides/routing.mdx index 990b7724e4827..618f55c646c26 100644 --- a/src/content/docs/ja/guides/routing.mdx +++ b/src/content/docs/ja/guides/routing.mdx @@ -6,6 +6,7 @@ i18nReady: true import FileTree from '~/components/FileTree.astro' import RecipeLinks from "~/components/RecipeLinks.astro" import Since from '~/components/Since.astro' +import ReadMore from '~/components/ReadMore.astro' Astroは**ファイルベースルーティング**を使用して、プロジェクトの`src/pages/`ディレクトリのファイルレイアウトを元にビルドURLを生成します。 @@ -84,7 +85,7 @@ const { lang, version } = Astro.params; パラメーターはパス内の異なる部分に設定できます。たとえば、上と同じ`getStaticPaths()`をもつ`src/pages/[lang]/[version]/info.astro`ファイルは、`/en/v1/info`と`/fr/v2/info`のルートを生成します。 -📚 [`getStaticPaths()`](/ja/reference/api-reference/#getstaticpaths)についてもっと学ぶ。 +[`getStaticPaths()`](/ja/reference/api-reference/#getstaticpaths)についてもっと学ぶ。 From 21e97b5cdd4892a2c48ac2d00eb126729d72d5d1 Mon Sep 17 00:00:00 2001 From: fhiromasa <74556046+fhiromasa@users.noreply.github.com> Date: Sun, 3 Mar 2024 16:25:27 +0900 Subject: [PATCH 05/11] Update routing.mdx in ja Document new routing priority behavior (#6386) --- src/content/docs/ja/guides/routing.mdx | 28 ++++++++++++++------------ 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/src/content/docs/ja/guides/routing.mdx b/src/content/docs/ja/guides/routing.mdx index 618f55c646c26..3156392743dca 100644 --- a/src/content/docs/ja/guides/routing.mdx +++ b/src/content/docs/ja/guides/routing.mdx @@ -296,32 +296,34 @@ if (!isLoggedIn(cookie)) { ## ルーティングの優先順位 -複数のルートが同じURLのパスにマッチすることがあります。たとえば、以下の各ルートは`/posts/create`にマッチします。 +複数のルートが同じURLパスをビルドする可能性があります。たとえば、これらのルートはすべて`/posts/create`をビルドできます。 - src/pages/ + - [...slug].astro - posts/ - create.astro - - [pid].astro + - [page].astro + - [pid].ts - [...slug].astro Astroは、ページをビルドするためにどのルートを使用すべきかを知る必要があります。そのために、以下のルールにしたがってルートの順番を決定します。 -- パスパラメーターを持たない静的ルートは、他のすべてのルーティングよりも優先される -- 名前付きパラメーターを使用する動的ルーティングは、レストパラメーターよりも優先される -- 事前レンダリングされた動的ルートは、サーバーの動的ルートよりも優先される -- レストパラメーターはもっとも低い優先度となる -- エンドポイントは常にページよりも優先される -- 同順位はアルファベット順に解決される +- 多くのパスセグメントを持つルートが、抽象的なルートよりも優先される。例えば、`/posts/` 配下のすべてのルートが、 `/[...slug].astro` よりも優先される。 +- パスパラメーターを持たない静的ルートは、動的ルートより優先される。例えば、`/posts/create.astro` は、他のすべてのルートよりも優先される。 +- 名前付きパラメーターを使用する動的ルーティングは、レストパラメーターよりも優先される。例えば、`/posts/[page].astro` は `/posts/[...slug].astro` よりも優先される。 +- SSGの動的ルートは、SSRの動的ルートよりも優先される。 +- エンドポイントは常にページよりも優先される。 +- ルートを上記のルールで解決できない場合、Nodeのデフォルトロケールに基づいてアルファベット順に解決される。 上記のようにファイルが配置されている場合に、リクエストされたURLと、HTMLをビルドするために使用されるルートがどのようにマッチングされるかの例をいくつか見てみましょう。 -- `pages/posts/create.Astro` - `/posts/create`をビルドします -- `pages/posts/[pid].astro` - `/posts/1`, `/posts/abc`などをビルドします。しかし、`/posts/create`はビルドされません -- `pages/posts/[...slug].Astro` - `/posts/1/2`, `/posts/a/b/c`などをビルドします。しかし、 `/posts/create`、`/posts/1`、`/posts/abc`はビルドされません - -リダイレクトも同じルールに従いますが、優先順位は*最後*になります。つまり、ファイルベースのルートとリダイレクトが同じルート優先順位である場合、ファイルベースのルートが選択されます。 +- `pages/posts/create.Astro` - `/posts/create`だけをビルドします +- `pages/posts/[pid].ts` - `/posts/abc`, `/posts/xyz`などをビルドします。しかし、`/posts/create`はビルドしません +- `pages/posts/[page].astro` - `/posts/1`, `/posts/2`などをビルドします。しかし、`/posts/create`, `/posts/abc`, `/posts/xyz`はビルドしません +- `pages/posts/[...slug].astro` - `/posts/1/2`, `/posts/a/b/c`などをビルドします。しかし、`/posts/create`, `/posts/1`, `/posts/abc`などはビルドしません +- `pages/[...slug].astro` - `/abc`, `/xyz`, `/abc/xyz`などをビルドします。しかし、`/posts/create`, `/posts/1`, `/posts/abc`などはビルドしません ## ページネーション From cb9f402dde56921b91c851807368f0b4ef9ae514 Mon Sep 17 00:00:00 2001 From: fhiromasa <74556046+fhiromasa@users.noreply.github.com> Date: Sun, 3 Mar 2024 22:12:09 +0900 Subject: [PATCH 06/11] Update src/content/docs/ja/guides/routing.mdx Co-authored-by: Shinya Fujino --- src/content/docs/ja/guides/routing.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/content/docs/ja/guides/routing.mdx b/src/content/docs/ja/guides/routing.mdx index 3156392743dca..9684fca63520a 100644 --- a/src/content/docs/ja/guides/routing.mdx +++ b/src/content/docs/ja/guides/routing.mdx @@ -308,7 +308,7 @@ if (!isLoggedIn(cookie)) { - [...slug].astro -Astroは、ページをビルドするためにどのルートを使用すべきかを知る必要があります。そのために、以下のルールにしたがってルートの順番を決定します。 +Astroは、ページをビルドするためにどのルートを使用すべきかを知る必要があります。そのために、以下のルールを順に適用してルートの順番を決定します。 - 多くのパスセグメントを持つルートが、抽象的なルートよりも優先される。例えば、`/posts/` 配下のすべてのルートが、 `/[...slug].astro` よりも優先される。 - パスパラメーターを持たない静的ルートは、動的ルートより優先される。例えば、`/posts/create.astro` は、他のすべてのルートよりも優先される。 From b3878b32bda424384588459eb06791848ee6601f Mon Sep 17 00:00:00 2001 From: fhiromasa <74556046+fhiromasa@users.noreply.github.com> Date: Sun, 3 Mar 2024 22:12:53 +0900 Subject: [PATCH 07/11] Update src/content/docs/ja/guides/routing.mdx Co-authored-by: Shinya Fujino --- src/content/docs/ja/guides/routing.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/content/docs/ja/guides/routing.mdx b/src/content/docs/ja/guides/routing.mdx index 9684fca63520a..37616ac9a392a 100644 --- a/src/content/docs/ja/guides/routing.mdx +++ b/src/content/docs/ja/guides/routing.mdx @@ -310,7 +310,7 @@ if (!isLoggedIn(cookie)) { Astroは、ページをビルドするためにどのルートを使用すべきかを知る必要があります。そのために、以下のルールを順に適用してルートの順番を決定します。 -- 多くのパスセグメントを持つルートが、抽象的なルートよりも優先される。例えば、`/posts/` 配下のすべてのルートが、 `/[...slug].astro` よりも優先される。 +- より多くのパスセグメントを持つルートが、詳細度が低いルートよりも優先される。上の例では、`/posts/`配下のすべてのルートが、`/[...slug].astro`よりも優先される。 - パスパラメーターを持たない静的ルートは、動的ルートより優先される。例えば、`/posts/create.astro` は、他のすべてのルートよりも優先される。 - 名前付きパラメーターを使用する動的ルーティングは、レストパラメーターよりも優先される。例えば、`/posts/[page].astro` は `/posts/[...slug].astro` よりも優先される。 - SSGの動的ルートは、SSRの動的ルートよりも優先される。 From 14532622f2a0dc243f72870e542788c05db20877 Mon Sep 17 00:00:00 2001 From: fhiromasa <74556046+fhiromasa@users.noreply.github.com> Date: Sun, 3 Mar 2024 22:13:11 +0900 Subject: [PATCH 08/11] Update src/content/docs/ja/guides/routing.mdx Co-authored-by: Shinya Fujino --- src/content/docs/ja/guides/routing.mdx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/content/docs/ja/guides/routing.mdx b/src/content/docs/ja/guides/routing.mdx index 37616ac9a392a..c4be92ec82527 100644 --- a/src/content/docs/ja/guides/routing.mdx +++ b/src/content/docs/ja/guides/routing.mdx @@ -311,8 +311,8 @@ if (!isLoggedIn(cookie)) { Astroは、ページをビルドするためにどのルートを使用すべきかを知る必要があります。そのために、以下のルールを順に適用してルートの順番を決定します。 - より多くのパスセグメントを持つルートが、詳細度が低いルートよりも優先される。上の例では、`/posts/`配下のすべてのルートが、`/[...slug].astro`よりも優先される。 -- パスパラメーターを持たない静的ルートは、動的ルートより優先される。例えば、`/posts/create.astro` は、他のすべてのルートよりも優先される。 -- 名前付きパラメーターを使用する動的ルーティングは、レストパラメーターよりも優先される。例えば、`/posts/[page].astro` は `/posts/[...slug].astro` よりも優先される。 +- パスパラメーターを持たない静的ルートは、動的ルートより優先される。例えば、`/posts/create.astro`は、他のすべてのルートよりも優先される。 +- 名前付きパラメーターを使用する動的ルーティングは、レストパラメーターよりも優先される。例えば、`/posts/[page].astro`は`/posts/[...slug].astro`よりも優先される。 - SSGの動的ルートは、SSRの動的ルートよりも優先される。 - エンドポイントは常にページよりも優先される。 - ルートを上記のルールで解決できない場合、Nodeのデフォルトロケールに基づいてアルファベット順に解決される。 From 147a1768401d5671ec3fc1055c8034785e240c9a Mon Sep 17 00:00:00 2001 From: fhiromasa <74556046+fhiromasa@users.noreply.github.com> Date: Sun, 3 Mar 2024 22:13:22 +0900 Subject: [PATCH 09/11] Update src/content/docs/ja/guides/routing.mdx Co-authored-by: Shinya Fujino --- src/content/docs/ja/guides/routing.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/content/docs/ja/guides/routing.mdx b/src/content/docs/ja/guides/routing.mdx index c4be92ec82527..07133ba2428ce 100644 --- a/src/content/docs/ja/guides/routing.mdx +++ b/src/content/docs/ja/guides/routing.mdx @@ -313,7 +313,7 @@ Astroは、ページをビルドするためにどのルートを使用すべき - より多くのパスセグメントを持つルートが、詳細度が低いルートよりも優先される。上の例では、`/posts/`配下のすべてのルートが、`/[...slug].astro`よりも優先される。 - パスパラメーターを持たない静的ルートは、動的ルートより優先される。例えば、`/posts/create.astro`は、他のすべてのルートよりも優先される。 - 名前付きパラメーターを使用する動的ルーティングは、レストパラメーターよりも優先される。例えば、`/posts/[page].astro`は`/posts/[...slug].astro`よりも優先される。 -- SSGの動的ルートは、SSRの動的ルートよりも優先される。 +- 事前レンダリングされた動的ルートは、サーバーの動的ルートよりも優先される。 - エンドポイントは常にページよりも優先される。 - ルートを上記のルールで解決できない場合、Nodeのデフォルトロケールに基づいてアルファベット順に解決される。 From 40df2d1791a987fad6b15294d3d59ab094b517bd Mon Sep 17 00:00:00 2001 From: fhiromasa <74556046+fhiromasa@users.noreply.github.com> Date: Sun, 3 Mar 2024 22:13:47 +0900 Subject: [PATCH 10/11] Update src/content/docs/ja/guides/routing.mdx Co-authored-by: Shinya Fujino --- src/content/docs/ja/guides/routing.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/content/docs/ja/guides/routing.mdx b/src/content/docs/ja/guides/routing.mdx index 07133ba2428ce..41b48e3c8167c 100644 --- a/src/content/docs/ja/guides/routing.mdx +++ b/src/content/docs/ja/guides/routing.mdx @@ -314,7 +314,7 @@ Astroは、ページをビルドするためにどのルートを使用すべき - パスパラメーターを持たない静的ルートは、動的ルートより優先される。例えば、`/posts/create.astro`は、他のすべてのルートよりも優先される。 - 名前付きパラメーターを使用する動的ルーティングは、レストパラメーターよりも優先される。例えば、`/posts/[page].astro`は`/posts/[...slug].astro`よりも優先される。 - 事前レンダリングされた動的ルートは、サーバーの動的ルートよりも優先される。 -- エンドポイントは常にページよりも優先される。 +- エンドポイントはページよりも優先される。 - ルートを上記のルールで解決できない場合、Nodeのデフォルトロケールに基づいてアルファベット順に解決される。 上記のようにファイルが配置されている場合に、リクエストされたURLと、HTMLをビルドするために使用されるルートがどのようにマッチングされるかの例をいくつか見てみましょう。 From 6b6637184d1e94d6c184fe93e7cf1ed1e73bb1f3 Mon Sep 17 00:00:00 2001 From: fhiromasa <74556046+fhiromasa@users.noreply.github.com> Date: Sun, 3 Mar 2024 22:14:04 +0900 Subject: [PATCH 11/11] Update src/content/docs/ja/guides/routing.mdx Co-authored-by: Shinya Fujino --- src/content/docs/ja/guides/routing.mdx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/content/docs/ja/guides/routing.mdx b/src/content/docs/ja/guides/routing.mdx index 41b48e3c8167c..f7741cf4bd8ba 100644 --- a/src/content/docs/ja/guides/routing.mdx +++ b/src/content/docs/ja/guides/routing.mdx @@ -320,10 +320,10 @@ Astroは、ページをビルドするためにどのルートを使用すべき 上記のようにファイルが配置されている場合に、リクエストされたURLと、HTMLをビルドするために使用されるルートがどのようにマッチングされるかの例をいくつか見てみましょう。 - `pages/posts/create.Astro` - `/posts/create`だけをビルドします -- `pages/posts/[pid].ts` - `/posts/abc`, `/posts/xyz`などをビルドします。しかし、`/posts/create`はビルドしません -- `pages/posts/[page].astro` - `/posts/1`, `/posts/2`などをビルドします。しかし、`/posts/create`, `/posts/abc`, `/posts/xyz`はビルドしません -- `pages/posts/[...slug].astro` - `/posts/1/2`, `/posts/a/b/c`などをビルドします。しかし、`/posts/create`, `/posts/1`, `/posts/abc`などはビルドしません -- `pages/[...slug].astro` - `/abc`, `/xyz`, `/abc/xyz`などをビルドします。しかし、`/posts/create`, `/posts/1`, `/posts/abc`などはビルドしません +- `pages/posts/[pid].ts` - `/posts/abc`、`/posts/xyz`などをビルドします。しかし、`/posts/create`はビルドしません +- `pages/posts/[page].astro` - `/posts/1`、`/posts/2`などをビルドします。しかし、`/posts/create`、`/posts/abc`、`/posts/xyz`はビルドしません +- `pages/posts/[...slug].astro` - `/posts/1/2`、`/posts/a/b/c`などをビルドします。しかし、`/posts/create`、`/posts/1`、`/posts/abc`などはビルドしません +- `pages/[...slug].astro` - `/abc`、`/xyz`、`/abc/xyz`などをビルドします。しかし、`/posts/create`、`/posts/1`、`/posts/abc`などはビルドしません ## ページネーション