{"id":27,"date":"2026-03-29T08:37:23","date_gmt":"2026-03-28T23:37:23","guid":{"rendered":"https:\/\/article.adbandit.org\/?p=27"},"modified":"2026-03-30T15:36:34","modified_gmt":"2026-03-30T06:36:34","slug":"nextjs-app-router-routing-layout-guide","status":"publish","type":"post","link":"https:\/\/article.adbandit.org\/?p=27","title":{"rendered":"Next.js App Router\u306e\u4f7f\u3044\u65b9\uff1a\u30eb\u30fc\u30c6\u30a3\u30f3\u30b0\u30fb\u30ec\u30a4\u30a2\u30a6\u30c8\u30fb\u30c7\u30fc\u30bf\u30d5\u30a7\u30c3\u30c1\u5b9f\u8df5\u30ac\u30a4\u30c9"},"content":{"rendered":"<h2>App Router\u306e\u30d5\u30a1\u30a4\u30eb\u898f\u7d04<\/h2>\n<p>Next.js App Router\u3067\u306f\u3001\u7279\u5b9a\u306e\u30d5\u30a1\u30a4\u30eb\u540d\u304c\u305d\u308c\u305e\u308c\u306e\u5f79\u5272\u3092\u6301\u3061\u307e\u3059\u3002\u3053\u306e\u898f\u7d04\u3092\u7406\u89e3\u3059\u308b\u3053\u3068\u304cApp Router\u7fd2\u5f97\u306e\u7b2c\u4e00\u6b69\u3067\u3059\u3002<\/p>\n<ul>\n<li><strong>page.tsx<\/strong>\uff1a\u305d\u306eURL\u306b\u5bfe\u5fdc\u3059\u308b\u30da\u30fc\u30b8\u30b3\u30f3\u30dd\u30fc\u30cd\u30f3\u30c8\uff08\u516c\u958bURL\uff09<\/li>\n<li><strong>layout.tsx<\/strong>\uff1a\u5b50\u30da\u30fc\u30b8\u3092\u5305\u3080\u30ec\u30a4\u30a2\u30a6\u30c8\uff08\u30ca\u30d3\u30b2\u30fc\u30b7\u30e7\u30f3\u30fb\u30b5\u30a4\u30c9\u30d0\u30fc\u7b49\uff09<\/li>\n<li><strong>loading.tsx<\/strong>\uff1a\u30c7\u30fc\u30bf\u30d5\u30a7\u30c3\u30c1\u4e2d\u306b\u8868\u793a\u3059\u308b\u30ed\u30fc\u30c7\u30a3\u30f3\u30b0UI\uff08React Suspense\u81ea\u52d5\u9069\u7528\uff09<\/li>\n<li><strong>error.tsx<\/strong>\uff1a\u30a8\u30e9\u30fc\u767a\u751f\u6642\u306b\u8868\u793a\u3059\u308b\u30a8\u30e9\u30fcUI\uff08Client Component\u5fc5\u9808\uff09<\/li>\n<li><strong>not-found.tsx<\/strong>\uff1a404\u30da\u30fc\u30b8\u306e\u30ab\u30b9\u30bf\u30de\u30a4\u30ba<\/li>\n<li><strong>route.ts<\/strong>\uff1aAPI\u30a8\u30f3\u30c9\u30dd\u30a4\u30f3\u30c8\uff08GET\/POST\/PUT\/DELETE\u7b49\uff09<\/li>\n<li><strong>template.tsx<\/strong>\uff1alayout\u3068\u4f3c\u308b\u304c\u3001\u30ca\u30d3\u30b2\u30fc\u30b7\u30e7\u30f3\u6bce\u306b\u518d\u30de\u30a6\u30f3\u30c8\u3055\u308c\u308b<\/li>\n<\/ul>\n<h2>\u30eb\u30fc\u30c6\u30a3\u30f3\u30b0\u306e\u30d1\u30bf\u30fc\u30f3<\/h2>\n<h3>\u52d5\u7684\u30eb\u30fc\u30c8<\/h3>\n<p>`app\/blog\/[slug]\/page.tsx`\u306e\u3088\u3046\u306b\u89d2\u62ec\u5f27\u3067\u30d1\u30e9\u30e1\u30fc\u30bf\u3092\u5b9a\u7fa9\u3057\u307e\u3059\u3002`params.slug`\u3067\u30d1\u30e9\u30e1\u30fc\u30bf\u5024\u306b\u30a2\u30af\u30bb\u30b9\u3067\u304d\u307e\u3059\u3002\u8907\u6570\u30d1\u30e9\u30e1\u30fc\u30bf\u306f`[&#8230;segments]`\uff08\u30ad\u30e3\u30c3\u30c1\u30aa\u30fc\u30eb\uff09\u3084`[[&#8230;segments]]`\uff08\u30aa\u30d7\u30b7\u30e7\u30ca\u30eb\u30ad\u30e3\u30c3\u30c1\u30aa\u30fc\u30eb\uff09\u3067\u5bfe\u5fdc\u3057\u307e\u3059\u3002<\/p>\n<h3>\u30eb\u30fc\u30c8\u30b0\u30eb\u30fc\u30d7<\/h3>\n<p>`(group)`\u306e\u3088\u3046\u306b\u4e38\u62ec\u5f27\u3067\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u3092\u4f5c\u308b\u3068URL\u306b\u5f71\u97ff\u305b\u305a\u306b\u30d5\u30a1\u30a4\u30eb\u3092\u30b0\u30eb\u30fc\u30d7\u5316\u3067\u304d\u307e\u3059\u3002`app\/(marketing)\/about\/page.tsx`\u306fURL\u304c`\/about`\u306b\u306a\u308a\u307e\u3059\u3002\u8a8d\u8a3c\u304c\u5fc5\u8981\u306a\u30da\u30fc\u30b8\u3068\u30d1\u30d6\u30ea\u30c3\u30af\u30da\u30fc\u30b8\u3092\u5206\u3051\u308b\u969b\u306b\u4f7f\u3044\u307e\u3059\u3002<\/p>\n<h3>\u4e26\u5217\u30eb\u30fc\u30c8\uff08@slot\uff09<\/h3>\n<p>`app\/@modal\/page.tsx`\u306e\u3088\u3046\u306b`@`\u304b\u3089\u59cb\u307e\u308b\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u306f\u3001\u540c\u3058\u30ec\u30a4\u30a2\u30a6\u30c8\u5185\u306b\u8907\u6570\u306e\u30da\u30fc\u30b8\u3092\u540c\u6642\u8868\u793a\u3059\u308b\u300c\u4e26\u5217\u30eb\u30fc\u30c8\uff08Parallel Routes\uff09\u300d\u3067\u3059\u3002\u30e2\u30fc\u30c0\u30eb\u3068\u80cc\u666f\u30da\u30fc\u30b8\u3092\u540c\u6642\u306b\u7ba1\u7406\u3067\u304d\u307e\u3059\u3002<\/p>\n<h2>\u30cd\u30b9\u30c8\u30ec\u30a4\u30a2\u30a6\u30c8\u306e\u8a2d\u8a08<\/h2>\n<p>App Router\u306e\u30ec\u30a4\u30a2\u30a6\u30c8\u306f\u30cd\u30b9\u30c8\u53ef\u80fd\u3067\u3059\u3002`app\/layout.tsx`\uff08\u5168\u4f53\u30ec\u30a4\u30a2\u30a6\u30c8\uff09\u2192`app\/(user)\/layout.tsx`\uff08\u8a8d\u8a3c\u5f8c\u30a8\u30ea\u30a2\u306e\u30ec\u30a4\u30a2\u30a6\u30c8\uff09\u2192`app\/(user)\/dashboard\/layout.tsx`\uff08\u30c0\u30c3\u30b7\u30e5\u30dc\u30fc\u30c9\u56fa\u6709\u306e\u30ec\u30a4\u30a2\u30a6\u30c8\uff09\u3068\u3044\u3046\u968e\u5c64\u69cb\u9020\u304c\u7d44\u3081\u307e\u3059\u3002\u5404\u30ec\u30a4\u30a2\u30a6\u30c8\u306f\u5b50\u30b3\u30f3\u30dd\u30fc\u30cd\u30f3\u30c8\u304c\u5909\u308f\u3063\u3066\u3082\u518d\u30ec\u30f3\u30c0\u30ea\u30f3\u30b0\u3055\u308c\u307e\u305b\u3093\u3002<\/p>\n<h2>Server Actions\u306e\u6d3b\u7528<\/h2>\n<p>Next.js 14\u4ee5\u964d\u306eServer Actions\u306b\u3088\u308a\u3001\u30d5\u30a9\u30fc\u30e0\u304b\u3089API\u30a8\u30f3\u30c9\u30dd\u30a4\u30f3\u30c8\u3092\u7d4c\u7531\u305b\u305a\u306b\u76f4\u63a5\u30b5\u30fc\u30d0\u30fc\u95a2\u6570\u3092\u547c\u3073\u51fa\u305b\u307e\u3059\u3002`&#8217;use server&#8217;`\u30c7\u30a3\u30ec\u30af\u30c6\u30a3\u30d6\u3092\u4f7f\u3046\u3053\u3068\u3067\u3001\u30af\u30e9\u30a4\u30a2\u30f3\u30c8\u304b\u3089\u30b5\u30fc\u30d0\u30fc\u95a2\u6570\u3092\u76f4\u63a5\u547c\u3073\u51fa\u3059\u5b9f\u88c5\u304c\u53ef\u80fd\u3067\u3059\u3002\u30c7\u30fc\u30bf\u5909\u66f4\u5f8c\u306e`revalidatePath`\u30fb`revalidateTag`\u3067\u30ad\u30e3\u30c3\u30b7\u30e5\u3092\u7121\u52b9\u5316\u3057\u307e\u3059\u3002<\/p>\n<h2>\u30e1\u30bf\u30c7\u30fc\u30bf\u3068SEO<\/h2>\n<p>App Router\u3067\u306fmetadata\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3092export\u3059\u308b\u3060\u3051\u3067SEO\u30bf\u30b0\u304c\u81ea\u52d5\u8a2d\u5b9a\u3055\u308c\u307e\u3059\u3002<\/p>\n<ul>\n<li>\u9759\u7684\u30e1\u30bf\u30c7\u30fc\u30bf\uff1a`export const metadata: Metadata = { title: &#8216;\u30da\u30fc\u30b8\u30bf\u30a4\u30c8\u30eb&#8217;, description: &#8216;\u8aac\u660e&#8217; }`<\/li>\n<li>\u52d5\u7684\u30e1\u30bf\u30c7\u30fc\u30bf\uff1a`export async function generateMetadata({ params }) { return { title: await getTitle(params.slug) } }`<\/li>\n<li>Open Graph\u30bf\u30b0\u30fbTwitter\u30ab\u30fc\u30c9\u3082`metadata`\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3067\u8a2d\u5b9a\u53ef\u80fd<\/li>\n<\/ul>\n<h2>\u307e\u3068\u3081<\/h2>\n<p>App Router\u306fPage Router\u3088\u308a\u8907\u96d1\u3067\u3059\u304c\u3001Server Components\u30fb\u30cd\u30b9\u30c8\u30ec\u30a4\u30a2\u30a6\u30c8\u30fbServer Actions\u306b\u3088\u308a\u3001\u3088\u308a\u5ba3\u8a00\u7684\u3067\u30d1\u30d5\u30a9\u30fc\u30de\u30f3\u30b9\u306e\u9ad8\u3044\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u304c\u69cb\u7bc9\u3067\u304d\u307e\u3059\u3002<a href=\"https:\/\/article.adbandit.org\/?p=26\">Next.js\u5165\u9580<\/a>\u3067React\u3068Next.js\u306e\u57fa\u790e\u3092\u62bc\u3055\u3048\u3066\u304b\u3089\u3001App Router\u306e\u5404\u6a5f\u80fd\u3092\u6bb5\u968e\u7684\u306b\u7fd2\u5f97\u3059\u308b\u3053\u3068\u3092\u304a\u52e7\u3081\u3057\u307e\u3059\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>WordPress \u30ab\u30c6\u30b4\u30ea\u30fb\u30bf\u30b0\u3092 SEO \u6700\u9069\u5316\u3067\u691c\u7d22\u6d41\u5165 30% \u5897\u52a0\u3002\u30ab\u30c6\u30b4\u30ea 7\uff5e12 \u500b\u3001\u30bf\u30b0 100 \u500b\u4ee5\u4e0b\u306b\u524a\u6e1b\u3002\u8aac\u660e\u6587\u6700\u9069\u5316\u3068\u30e1\u30bf\u30c7\u30a3\u30b9\u30af\u30ea\u30d7\u30b7\u30e7\u30f3\u8a2d\u5b9a\u3002<\/p>\n","protected":false},"author":1,"featured_media":650,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_yoast_wpseo_metadesc":"Next.js App Router\u306e\u5b9f\u8df5\u7684\u306a\u4f7f\u3044\u65b9\u3092\u89e3\u8aac\u3002\u30d5\u30a1\u30a4\u30eb\u30d9\u30fc\u30b9\u30eb\u30fc\u30c6\u30a3\u30f3\u30b0\u30fb\u30cd\u30b9\u30c8\u30ec\u30a4\u30a2\u30a6\u30c8\u30fb\u30ed\u30fc\u30c7\u30a3\u30f3\u30b0UI\u30fb\u30a8\u30e9\u30fc\u30cf\u30f3\u30c9\u30ea\u30f3\u30b0\u30fb\u4e26\u5217\u30eb\u30fc\u30c8\u30fb\u30a4\u30f3\u30bf\u30fc\u30bb\u30d7\u30c8\u30eb\u30fc\u30c8\u306e\u5b9f\u88c5\u65b9\u6cd5\u3092\u8a73\u3057\u304f\u7d39\u4ecb\u3057\u307e\u3059\u3002","_yoast_wpseo_title":"","_yoast_wpseo_focuskw":"","_yoast_wpseo_canonical":"","footnotes":""},"categories":[1],"tags":[],"class_list":["post-27","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/article.adbandit.org\/index.php?rest_route=\/wp\/v2\/posts\/27","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/article.adbandit.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/article.adbandit.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/article.adbandit.org\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/article.adbandit.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=27"}],"version-history":[{"count":1,"href":"https:\/\/article.adbandit.org\/index.php?rest_route=\/wp\/v2\/posts\/27\/revisions"}],"predecessor-version":[{"id":233,"href":"https:\/\/article.adbandit.org\/index.php?rest_route=\/wp\/v2\/posts\/27\/revisions\/233"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/article.adbandit.org\/index.php?rest_route=\/wp\/v2\/media\/650"}],"wp:attachment":[{"href":"https:\/\/article.adbandit.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=27"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/article.adbandit.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=27"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/article.adbandit.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=27"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}