Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DEV-2005] fix structured data #1308

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/unlucky-garlics-peel.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"nextjs-website": minor
---

Fix empty metadata field in listitems
MarBert marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -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}`,
Expand Down
4 changes: 3 additions & 1 deletion apps/nextjs-website/src/app/[productSlug]/api/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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']),
},
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 || []),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ const GuideListPage = async ({ params }: ProductParams) => {
breadcrumbsItems: [
productToBreadcrumb(product),
{
name: seo?.metaTitle,
name: seo?.metaTitle || abstract?.title,
item: breadcrumbItemByProduct(product, ['guides']),
},
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import {
breadcrumbItemByProduct,
productToBreadcrumb,
} from '@/helpers/structuredData.helpers';
import { title } from 'process';

export async function generateStaticParams() {
return [...getProductsSlugs('quickStart')].map((productSlug) => ({
Expand Down Expand Up @@ -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']),
},
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ import {
productToBreadcrumb,
} from '@/helpers/structuredData.helpers';
import { getUrlReplaceMapProps } from '@/lib/cmsApi';
import { title } from 'process';

type Params = {
productSlug: string;
Expand Down Expand Up @@ -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 || []),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ const TutorialsPage = async ({ params }: ProductParams) => {
breadcrumbsItems: [
productToBreadcrumb(product),
{
name: seo?.metaTitle,
name: seo?.metaTitle || abstract?.title,
item: breadcrumbItemByProduct(product, ['tutorials']),
},
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ const Page = async ({ params }: { params: Params }) => {
const structuredData = generateStructuredDataScripts({
breadcrumbsItems: [
{
name: caseHistory.seo?.metaTitle,
name: caseHistory.seo?.metaTitle || params.caseHistorySlug,
MarBert marked this conversation as resolved.
Show resolved Hide resolved
item: getItemFromPaths(['case-histories', caseHistory.slug]),
},
],
Expand Down
Loading