From b9d69b7b02b62d37b937e441b144807902ae509c Mon Sep 17 00:00:00 2001 From: Marcello Bertoli Date: Thu, 16 Jan 2025 18:09:04 +0100 Subject: [PATCH 1/5] fix structured data in tutorial page --- .../[productSlug]/tutorials/[...productTutorialPage]/page.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/apps/nextjs-website/src/app/[productSlug]/tutorials/[...productTutorialPage]/page.tsx b/apps/nextjs-website/src/app/[productSlug]/tutorials/[...productTutorialPage]/page.tsx index 72d47f22ce..56555be847 100644 --- a/apps/nextjs-website/src/app/[productSlug]/tutorials/[...productTutorialPage]/page.tsx +++ b/apps/nextjs-website/src/app/[productSlug]/tutorials/[...productTutorialPage]/page.tsx @@ -31,6 +31,7 @@ import { productToBreadcrumb, } from '@/helpers/structuredData.helpers'; import { getUrlReplaceMapProps } from '@/lib/cmsApi'; +import { title } from 'process'; type Params = { productSlug: string; @@ -99,7 +100,7 @@ const Page = async ({ params }: { params: Params }) => { breadcrumbsItems: [ productToBreadcrumb(strapiTutorialProps.product), { - name: strapiTutorialProps.seo?.metaTitle, + name: strapiTutorialProps.seo?.metaTitle || strapiTutorialProps.title, item: breadcrumbItemByProduct(strapiTutorialProps.product, [ 'guides', ...(params?.productTutorialPage || []), From 06a74480adc64d07a78c7f2087441d329bf587a3 Mon Sep 17 00:00:00 2001 From: Marcello Bertoli Date: Fri, 17 Jan 2025 09:57:45 +0100 Subject: [PATCH 2/5] add default name if seo is missing --- .../src/app/[productSlug]/api/[apiDataSlug]/page.tsx | 2 +- apps/nextjs-website/src/app/[productSlug]/api/page.tsx | 4 +++- .../app/[productSlug]/guides/[...productGuidePage]/page.tsx | 2 +- apps/nextjs-website/src/app/[productSlug]/guides/page.tsx | 2 +- .../nextjs-website/src/app/[productSlug]/quick-start/page.tsx | 3 ++- apps/nextjs-website/src/app/[productSlug]/tutorials/page.tsx | 2 +- .../src/app/case-histories/[caseHistorySlug]/page.tsx | 2 +- 7 files changed, 10 insertions(+), 7 deletions(-) diff --git a/apps/nextjs-website/src/app/[productSlug]/api/[apiDataSlug]/page.tsx b/apps/nextjs-website/src/app/[productSlug]/api/[apiDataSlug]/page.tsx index 3fc2cbe39f..b02778224f 100644 --- a/apps/nextjs-website/src/app/[productSlug]/api/[apiDataSlug]/page.tsx +++ b/apps/nextjs-website/src/app/[productSlug]/api/[apiDataSlug]/page.tsx @@ -64,7 +64,7 @@ const ApiDataPage = async ({ params }: ApiDataParams) => { breadcrumbsItems: [ productToBreadcrumb(apiDataProps?.product), { - name: apiDataProps?.seo?.metaTitle, + name: apiDataProps?.seo?.metaTitle || apiDataProps?.title, item: breadcrumbItemByProduct(product, [ 'api', `${apiDataProps?.apiDataSlug}`, diff --git a/apps/nextjs-website/src/app/[productSlug]/api/page.tsx b/apps/nextjs-website/src/app/[productSlug]/api/page.tsx index 309a0458a7..8904eb7722 100644 --- a/apps/nextjs-website/src/app/[productSlug]/api/page.tsx +++ b/apps/nextjs-website/src/app/[productSlug]/api/page.tsx @@ -48,7 +48,9 @@ const ApiDataListPage = async ({ params }: { params: Params }) => { breadcrumbsItems: [ productToBreadcrumb(apiDataListPageProps?.product), { - name: apiDataListPageProps?.seo?.metaTitle, + name: + apiDataListPageProps?.seo?.metaTitle || + apiDataListPageProps?.hero.title, item: breadcrumbItemByProduct(apiDataListPageProps?.product, ['api']), }, ], diff --git a/apps/nextjs-website/src/app/[productSlug]/guides/[...productGuidePage]/page.tsx b/apps/nextjs-website/src/app/[productSlug]/guides/[...productGuidePage]/page.tsx index 0bcc1ae9e0..7c0fda6718 100644 --- a/apps/nextjs-website/src/app/[productSlug]/guides/[...productGuidePage]/page.tsx +++ b/apps/nextjs-website/src/app/[productSlug]/guides/[...productGuidePage]/page.tsx @@ -102,7 +102,7 @@ const Page = async ({ params }: { params: Params }) => { breadcrumbsItems: [ productToBreadcrumb(product), { - name: seo?.metaTitle, + name: seo?.metaTitle || page.title, item: breadcrumbItemByProduct(product, [ 'guides', ...(params?.productGuidePage || []), diff --git a/apps/nextjs-website/src/app/[productSlug]/guides/page.tsx b/apps/nextjs-website/src/app/[productSlug]/guides/page.tsx index 136d9ee165..a9464cd006 100644 --- a/apps/nextjs-website/src/app/[productSlug]/guides/page.tsx +++ b/apps/nextjs-website/src/app/[productSlug]/guides/page.tsx @@ -66,7 +66,7 @@ const GuideListPage = async ({ params }: ProductParams) => { breadcrumbsItems: [ productToBreadcrumb(product), { - name: seo?.metaTitle, + name: seo?.metaTitle || abstract?.title, item: breadcrumbItemByProduct(product, ['guides']), }, ], diff --git a/apps/nextjs-website/src/app/[productSlug]/quick-start/page.tsx b/apps/nextjs-website/src/app/[productSlug]/quick-start/page.tsx index 8b6cc7fa4b..41f3ec195c 100644 --- a/apps/nextjs-website/src/app/[productSlug]/quick-start/page.tsx +++ b/apps/nextjs-website/src/app/[productSlug]/quick-start/page.tsx @@ -19,6 +19,7 @@ import { breadcrumbItemByProduct, productToBreadcrumb, } from '@/helpers/structuredData.helpers'; +import { title } from 'process'; export async function generateStaticParams() { return [...getProductsSlugs('quickStart')].map((productSlug) => ({ @@ -73,7 +74,7 @@ const QuickStartGuidesPage = async ({ params }: ProductParams) => { breadcrumbsItems: [ productToBreadcrumb(product), { - name: seo?.metaTitle, + name: seo?.metaTitle || abstract?.title, item: breadcrumbItemByProduct(product, ['quick-start']), }, ], diff --git a/apps/nextjs-website/src/app/[productSlug]/tutorials/page.tsx b/apps/nextjs-website/src/app/[productSlug]/tutorials/page.tsx index 82cf47613e..ff835e10af 100644 --- a/apps/nextjs-website/src/app/[productSlug]/tutorials/page.tsx +++ b/apps/nextjs-website/src/app/[productSlug]/tutorials/page.tsx @@ -71,7 +71,7 @@ const TutorialsPage = async ({ params }: ProductParams) => { breadcrumbsItems: [ productToBreadcrumb(product), { - name: seo?.metaTitle, + name: seo?.metaTitle || abstract?.title, item: breadcrumbItemByProduct(product, ['tutorials']), }, ], diff --git a/apps/nextjs-website/src/app/case-histories/[caseHistorySlug]/page.tsx b/apps/nextjs-website/src/app/case-histories/[caseHistorySlug]/page.tsx index 9bdc356edb..941108944f 100644 --- a/apps/nextjs-website/src/app/case-histories/[caseHistorySlug]/page.tsx +++ b/apps/nextjs-website/src/app/case-histories/[caseHistorySlug]/page.tsx @@ -48,7 +48,7 @@ const Page = async ({ params }: { params: Params }) => { const structuredData = generateStructuredDataScripts({ breadcrumbsItems: [ { - name: caseHistory.seo?.metaTitle, + name: caseHistory.seo?.metaTitle || params.caseHistorySlug, item: getItemFromPaths(['case-histories', caseHistory.slug]), }, ], From 6d6b8e3c3cf680097d114c348b43e12f746693b4 Mon Sep 17 00:00:00 2001 From: Marcello Bertoli Date: Fri, 17 Jan 2025 10:00:06 +0100 Subject: [PATCH 3/5] add changeset --- .changeset/unlucky-garlics-peel.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/unlucky-garlics-peel.md diff --git a/.changeset/unlucky-garlics-peel.md b/.changeset/unlucky-garlics-peel.md new file mode 100644 index 0000000000..5784f88887 --- /dev/null +++ b/.changeset/unlucky-garlics-peel.md @@ -0,0 +1,5 @@ +--- +"nextjs-website": minor +--- + +Fix empty metadata field in listitems From 4051e701826dc8bfb4e33ed2067d2b1556e84eae Mon Sep 17 00:00:00 2001 From: MarBert <41899883+MarBert@users.noreply.github.com> Date: Fri, 17 Jan 2025 10:08:21 +0100 Subject: [PATCH 4/5] Update .changeset/unlucky-garlics-peel.md --- .changeset/unlucky-garlics-peel.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.changeset/unlucky-garlics-peel.md b/.changeset/unlucky-garlics-peel.md index 5784f88887..b86a5ab047 100644 --- a/.changeset/unlucky-garlics-peel.md +++ b/.changeset/unlucky-garlics-peel.md @@ -2,4 +2,4 @@ "nextjs-website": minor --- -Fix empty metadata field in listitems +Fix missing name field in listitems From 191e8d87df05f0c1bb1c55daa6db5411796d382b Mon Sep 17 00:00:00 2001 From: MarBert <41899883+MarBert@users.noreply.github.com> Date: Fri, 17 Jan 2025 10:32:11 +0100 Subject: [PATCH 5/5] Update apps/nextjs-website/src/app/case-histories/[caseHistorySlug]/page.tsx Co-authored-by: marcobottaro <39835990+marcobottaro@users.noreply.github.com> --- .../src/app/case-histories/[caseHistorySlug]/page.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/nextjs-website/src/app/case-histories/[caseHistorySlug]/page.tsx b/apps/nextjs-website/src/app/case-histories/[caseHistorySlug]/page.tsx index 941108944f..0a512d5a41 100644 --- a/apps/nextjs-website/src/app/case-histories/[caseHistorySlug]/page.tsx +++ b/apps/nextjs-website/src/app/case-histories/[caseHistorySlug]/page.tsx @@ -48,7 +48,7 @@ const Page = async ({ params }: { params: Params }) => { const structuredData = generateStructuredDataScripts({ breadcrumbsItems: [ { - name: caseHistory.seo?.metaTitle || params.caseHistorySlug, + name: caseHistory.seo?.metaTitle || caseHistory.title, item: getItemFromPaths(['case-histories', caseHistory.slug]), }, ],