From 0230dd8f362a4f81141a39ad5e3b11a09d41e117 Mon Sep 17 00:00:00 2001 From: Simon Vrachliotis Date: Tue, 23 Jul 2024 14:29:41 +1000 Subject: [PATCH 1/3] Fix static pages generation --- docs/app/(site)/blog/[post]/page.tsx | 7 ++----- docs/app/(site)/docs/[...rest]/page.tsx | 7 ++----- 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/docs/app/(site)/blog/[post]/page.tsx b/docs/app/(site)/blog/[post]/page.tsx index ae1eb980304..62d72c81820 100644 --- a/docs/app/(site)/blog/[post]/page.tsx +++ b/docs/app/(site)/blog/[post]/page.tsx @@ -62,10 +62,7 @@ export async function generateMetadata ({ params }): Promise { } // Static HTML page generation for each document page -export async function generateStaticPaths () { +export async function generateStaticParams () { const posts = await reader.collections.posts.list() - return { - paths: posts.map((post) => ({ params: { post } })), - fallback: false, - } + return posts.map((post) => ({ post })) } diff --git a/docs/app/(site)/docs/[...rest]/page.tsx b/docs/app/(site)/docs/[...rest]/page.tsx index ea5efb39653..e8d31131ac8 100644 --- a/docs/app/(site)/docs/[...rest]/page.tsx +++ b/docs/app/(site)/docs/[...rest]/page.tsx @@ -45,10 +45,7 @@ export async function generateMetadata ({ params }) { } // Static HTML page generation for each document page -export async function generateStaticPaths () { +export async function generateStaticParams () { const pages = await reader.collections.docs.list() - return { - paths: pages.map((page) => ({ params: { rest: page.split('/') } })), - fallback: false, - } + return pages.map((page) => ({ rest: page.split('/') })) } From 60cbf245921081573644b5d0696d75121454ce5c Mon Sep 17 00:00:00 2001 From: Simon Vrachliotis Date: Tue, 23 Jul 2024 14:52:13 +1000 Subject: [PATCH 2/3] Use `metadatabase` in the root layout's metadata according to Next.js' docs --- docs/app/(site)/blog/page.tsx | 2 +- docs/app/(site)/layout.tsx | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/docs/app/(site)/blog/page.tsx b/docs/app/(site)/blog/page.tsx index d28c66bd221..bbd57ff3655 100644 --- a/docs/app/(site)/blog/page.tsx +++ b/docs/app/(site)/blog/page.tsx @@ -11,7 +11,7 @@ export const metadata: Metadata = { title: 'Keystone Blog', description: 'Blog posts from the team maintaining Keystone.', openGraph: { - images: `${siteBaseUrl}/assets/blog/the-keystone-blog-cover.png` + images: '/assets/blog/the-keystone-blog-cover.png' } } diff --git a/docs/app/(site)/layout.tsx b/docs/app/(site)/layout.tsx index d97d1ab1651..f2cb4e4fd83 100644 --- a/docs/app/(site)/layout.tsx +++ b/docs/app/(site)/layout.tsx @@ -7,6 +7,7 @@ const defaultDescription = 'Build faster and scale further with the programmable open source GraphQL API back-end for structured content projects.' export const metadata: Metadata = { + metadataBase: new URL(siteBaseUrl), title: defaultTitle, description: defaultDescription, icons: { @@ -25,7 +26,7 @@ export const metadata: Metadata = { locale: 'en', images: [ { - url: `${siteBaseUrl}/og-image-landscape.png`, + url: '/og-image-landscape.png', width: 761, height: 410, alt: defaultDescription, @@ -38,7 +39,7 @@ export const metadata: Metadata = { card: 'summary_large_image', images: [ { - url: `${siteBaseUrl}/og-image-landscape.png`, + url: '/og-image-landscape.png', width: 761, height: 410, alt: defaultTitle, From 1dea59995272146bc2af0a48e80a20ad4c9b3790 Mon Sep 17 00:00:00 2001 From: Simon Vrachliotis Date: Tue, 23 Jul 2024 14:56:11 +1000 Subject: [PATCH 3/3] Undo unmerged changes to generateStaticParams --- docs/app/(site)/blog/[post]/page.tsx | 7 +++++-- docs/app/(site)/docs/[...rest]/page.tsx | 8 +++++--- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/docs/app/(site)/blog/[post]/page.tsx b/docs/app/(site)/blog/[post]/page.tsx index 62d72c81820..ae1eb980304 100644 --- a/docs/app/(site)/blog/[post]/page.tsx +++ b/docs/app/(site)/blog/[post]/page.tsx @@ -62,7 +62,10 @@ export async function generateMetadata ({ params }): Promise { } // Static HTML page generation for each document page -export async function generateStaticParams () { +export async function generateStaticPaths () { const posts = await reader.collections.posts.list() - return posts.map((post) => ({ post })) + return { + paths: posts.map((post) => ({ params: { post } })), + fallback: false, + } } diff --git a/docs/app/(site)/docs/[...rest]/page.tsx b/docs/app/(site)/docs/[...rest]/page.tsx index e8d31131ac8..b313c1e9b71 100644 --- a/docs/app/(site)/docs/[...rest]/page.tsx +++ b/docs/app/(site)/docs/[...rest]/page.tsx @@ -44,8 +44,10 @@ export async function generateMetadata ({ params }) { } } -// Static HTML page generation for each document page -export async function generateStaticParams () { +export async function generateStaticPaths () { const pages = await reader.collections.docs.list() - return pages.map((page) => ({ rest: page.split('/') })) + return { + paths: pages.map((page) => ({ params: { rest: page.split('/') } })), + fallback: false, + } }