diff --git a/src/app/(main)/biography/[slug]/page.tsx b/src/app/(main)/staff_member/[slug]/page.tsx similarity index 79% rename from src/app/(main)/biography/[slug]/page.tsx rename to src/app/(main)/staff_member/[slug]/page.tsx index 1daf0bc..a5b242a 100644 --- a/src/app/(main)/biography/[slug]/page.tsx +++ b/src/app/(main)/staff_member/[slug]/page.tsx @@ -1,36 +1,45 @@ import { BeforeFooterBlock } from "@/components/Blocks/BeforeFooter"; import HeroOther from "@/components/HeroOther"; import { fetchTeamDetail } from "@/services/payload/team"; +import { getDefaultMetadata } from "@/utils/metadata"; import { RichText } from "@payloadcms/richtext-lexical/react"; import Image from "next/image"; import { Metadata } from "next/types"; import { Suspense } from "react"; export async function generateMetadata({ params }: { params: Promise<{ slug: string }> }): Promise { - const name = "Cochise Oncology"; + const defaultMetadata = await getDefaultMetadata(); + const name = defaultMetadata.openGraph?.siteName ?? ""; let title = "Page"; - let description = "Page"; let imgUrl = ""; const slug = (await params).slug; - const blog = await fetchTeamDetail(decodeURIComponent(slug)); + const team = await fetchTeamDetail(decodeURIComponent(slug)); // check for blog data - if (!!blog) { - title = `${name} Staff - ${blog.data.name}`; - description = `${name} Staff - ${blog.data.name}`; - imgUrl = blog.imgUrl; + if (!!team) { + title = `${team.data.name} - ${name}`; + imgUrl = team.imgUrl; } - return { + defaultMetadata.title = title; + if (!!defaultMetadata.openGraph) { + // @ts-ignore + defaultMetadata.openGraph.type = "article"; + defaultMetadata.openGraph.title = title; + defaultMetadata.openGraph.images = !!imgUrl ? [imgUrl] : undefined; + } + defaultMetadata.twitter = { + card: "summary_large_image", title: title, - description: description, - openGraph: { - title: title, - description: description, - images: !!imgUrl ? { url: imgUrl } : undefined, - }, + images: !!imgUrl ? [imgUrl] : undefined, }; + defaultMetadata.other = { + "twitter:label1": "Est. reading time", + "twitter:data1": "1 minute", + }; + + return defaultMetadata; } export default async function BiographySinglePage({ params }: { params: Promise<{ slug: string }> }) { diff --git a/src/components/Blocks/OurTeam/index.tsx b/src/components/Blocks/OurTeam/index.tsx index 3340c2f..aca1d93 100644 --- a/src/components/Blocks/OurTeam/index.tsx +++ b/src/components/Blocks/OurTeam/index.tsx @@ -2,6 +2,7 @@ import Team from "@/components/Team"; type Team = { id: number; + slug: string; name: string; role: string; img: { url: string; alt: string }; diff --git a/src/components/Team.tsx b/src/components/Team.tsx index 573a036..2ef6f5d 100644 --- a/src/components/Team.tsx +++ b/src/components/Team.tsx @@ -2,25 +2,32 @@ import Link from "next/link"; import { CardTeam } from "./Teams/CardTeam"; -export default function Team({ data }: any) { +type Team = { + id: number; + slug: string; + name: string; + role: string; + img: { url: string; alt: string }; + biography: string; +}; + +export default function Team({ data }: { data: Team[] }) { return (
-
-
-

- Our Team - . -

-
+
+

+ Our Team + . +

-
+
{/* Team item */} {data.map((member: any, index: any) => ( -
+
- -
diff --git a/src/components/Teams/CardTeam.tsx b/src/components/Teams/CardTeam.tsx index bdc8552..bab7387 100644 --- a/src/components/Teams/CardTeam.tsx +++ b/src/components/Teams/CardTeam.tsx @@ -21,20 +21,6 @@ export function CardTeam({ data }: CardTeamProps) { data-wow-duration="1.2s" alt={`Image of ${data.name}`} /> -
-
- {[ - { platform: "Facebook", icon: "fa-facebook-f", url: "#" }, - { platform: "Twitter", icon: "fa-twitter", url: "#" }, - { platform: "Pinterest", icon: "fa-pinterest-p", url: "#" }, - ].map((social, idx) => ( - -
{social.platform}
- -
- ))} -
-
{data.name}
diff --git a/src/services/payload/team.ts b/src/services/payload/team.ts index 2d96fcd..7cf3f5b 100644 --- a/src/services/payload/team.ts +++ b/src/services/payload/team.ts @@ -2,17 +2,16 @@ import payloadConfig from "@/payload.config"; import { formatDate } from "@/utils/datetime"; import { getPayload } from "payload"; -export async function fetchTeamDetail(name: string | undefined) { +export async function fetchTeamDetail(slug: string) { const payload = await getPayload({ config: payloadConfig }); const blogDataQuery = await payload.find({ collection: "teams", where: { - name: { like: `%${name}%` }, + slug: { equals: slug }, }, limit: 1, pagination: false, }); - console.log("data", name); if (!blogDataQuery?.docs?.[0]) return null;