dev #14
BIN
public/assets/images/logo-dark.webp
Normal file
BIN
public/assets/images/logo-dark.webp
Normal file
Binary file not shown.
After Width: | Height: | Size: 14 KiB |
@ -8,8 +8,6 @@ import { headers } from "next/headers";
|
|||||||
export async function generateMetadata(): Promise<Metadata> {
|
export async function generateMetadata(): Promise<Metadata> {
|
||||||
const defaultMetadata = await getDefaultMetadata();
|
const defaultMetadata = await getDefaultMetadata();
|
||||||
defaultMetadata.title = `Homepage - ${defaultMetadata.openGraph?.siteName}`;
|
defaultMetadata.title = `Homepage - ${defaultMetadata.openGraph?.siteName}`;
|
||||||
defaultMetadata.description =
|
|
||||||
"Get compassionate care and excellent medical services from COCHISE ONCOLOGY in Sierra Vista, Arizona. We are the largest full-service cancer treatment center between Albuquerque, New Mexico and Tucson, Arizona.";
|
|
||||||
defaultMetadata.keywords = "Cochise Oncology, Oncology, Healthcare, Medical Services, Cancer Treatment";
|
defaultMetadata.keywords = "Cochise Oncology, Oncology, Healthcare, Medical Services, Cancer Treatment";
|
||||||
|
|
||||||
if (!!defaultMetadata?.openGraph) {
|
if (!!defaultMetadata?.openGraph) {
|
||||||
@ -28,6 +26,7 @@ export default async function Home() {
|
|||||||
const headersList = await headers();
|
const headersList = await headers();
|
||||||
const fullUrl = headersList.get("x-full-url");
|
const fullUrl = headersList.get("x-full-url");
|
||||||
const siteName = headersList.get("x-site-name");
|
const siteName = headersList.get("x-site-name");
|
||||||
|
const metaDesc = headersList.get("x-meta-desc");
|
||||||
|
|
||||||
const jsonLd = {
|
const jsonLd = {
|
||||||
"@context": "https://schema.org",
|
"@context": "https://schema.org",
|
||||||
@ -52,8 +51,7 @@ export default async function Home() {
|
|||||||
thumbnailUrl: [`${fullUrl}assets/images/cochise-welcome.png`],
|
thumbnailUrl: [`${fullUrl}assets/images/cochise-welcome.png`],
|
||||||
datePublished: "2024-07-18T16:29:29+00:00",
|
datePublished: "2024-07-18T16:29:29+00:00",
|
||||||
dateModified: "2025-02-24T21:01:50+00:00",
|
dateModified: "2025-02-24T21:01:50+00:00",
|
||||||
description:
|
description: metaDesc,
|
||||||
"Get compassionate care and excellent medical services from COCHISE ONCOLOGY in Sierra Vista, Arizona. We are the largest full-service cancer treatment center between Albuquerque, New Mexico and Tucson, Arizona.",
|
|
||||||
breadcrumb: {
|
breadcrumb: {
|
||||||
"@id": `${fullUrl}#breadcrumb`,
|
"@id": `${fullUrl}#breadcrumb`,
|
||||||
},
|
},
|
||||||
|
@ -3,7 +3,9 @@ import HeroOther from "@/components/HeroOther";
|
|||||||
import { fetchTeamDetail } from "@/services/payload/team";
|
import { fetchTeamDetail } from "@/services/payload/team";
|
||||||
import { getDefaultMetadata } from "@/utils/metadata";
|
import { getDefaultMetadata } from "@/utils/metadata";
|
||||||
import { RichText } from "@payloadcms/richtext-lexical/react";
|
import { RichText } from "@payloadcms/richtext-lexical/react";
|
||||||
|
import { headers } from "next/headers";
|
||||||
import Image from "next/image";
|
import Image from "next/image";
|
||||||
|
import { notFound } from "next/navigation";
|
||||||
import { Metadata } from "next/types";
|
import { Metadata } from "next/types";
|
||||||
import { Suspense } from "react";
|
import { Suspense } from "react";
|
||||||
|
|
||||||
@ -45,17 +47,94 @@ export async function generateMetadata({ params }: { params: Promise<{ slug: str
|
|||||||
export default async function BiographySinglePage({ params }: { params: Promise<{ slug: string }> }) {
|
export default async function BiographySinglePage({ params }: { params: Promise<{ slug: string }> }) {
|
||||||
const slug = (await params).slug;
|
const slug = (await params).slug;
|
||||||
const data = await fetchTeamDetail(decodeURIComponent(slug));
|
const data = await fetchTeamDetail(decodeURIComponent(slug));
|
||||||
if (!data?.data)
|
if (!data?.data) {
|
||||||
return (
|
notFound();
|
||||||
<>
|
}
|
||||||
<BeforeFooterBlock />
|
|
||||||
</>
|
const headersList = await headers();
|
||||||
);
|
const mainUrl = headersList.get("x-main-url");
|
||||||
|
const fullUrl = headersList.get("x-full-url");
|
||||||
|
const siteName = headersList.get("x-site-name");
|
||||||
|
const metaDesc = headersList.get("x-meta-desc");
|
||||||
|
|
||||||
|
const jsonLd = {
|
||||||
|
"@context": "https://schema.org",
|
||||||
|
"@graph": [
|
||||||
|
{
|
||||||
|
"@type": "WebPage",
|
||||||
|
"@id": fullUrl,
|
||||||
|
url: fullUrl,
|
||||||
|
name: `${data?.data?.name ?? ""} - ${siteName}`,
|
||||||
|
isPartOf: {
|
||||||
|
"@id": `${mainUrl}/#website`,
|
||||||
|
},
|
||||||
|
datePublished: data?.data?.createdAt,
|
||||||
|
dateModified: data?.data?.updatedAt,
|
||||||
|
description: metaDesc,
|
||||||
|
breadcrumb: {
|
||||||
|
"@id": `${fullUrl}#breadcrumb`,
|
||||||
|
},
|
||||||
|
inLanguage: "en-US",
|
||||||
|
potentialAction: [
|
||||||
|
{
|
||||||
|
"@type": "ReadAction",
|
||||||
|
target: [fullUrl],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"@type": "WebSite",
|
||||||
|
"@id": `${mainUrl}/#website`,
|
||||||
|
url: `${mainUrl}/`,
|
||||||
|
name: siteName,
|
||||||
|
description: "",
|
||||||
|
publisher: {
|
||||||
|
"@id": `${mainUrl}/#organization`,
|
||||||
|
},
|
||||||
|
potentialAction: [
|
||||||
|
{
|
||||||
|
"@type": "SearchAction",
|
||||||
|
target: {
|
||||||
|
"@type": "EntryPoint",
|
||||||
|
urlTemplate: `${mainUrl}/?s={search_term_string}`,
|
||||||
|
},
|
||||||
|
"query-input": {
|
||||||
|
"@type": "PropertyValueSpecification",
|
||||||
|
valueRequired: true,
|
||||||
|
valueName: "search_term_string",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
inLanguage: "en-US",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"@type": "Organization",
|
||||||
|
"@id": `${mainUrl}/#organization`,
|
||||||
|
name: siteName,
|
||||||
|
url: `${mainUrl}/`,
|
||||||
|
logo: {
|
||||||
|
"@type": "ImageObject",
|
||||||
|
thumbnailUrl: data.imgUrl,
|
||||||
|
inLanguage: "en-US",
|
||||||
|
"@id": `${mainUrl}/#primaryimage`,
|
||||||
|
url: data.imgUrl,
|
||||||
|
contentUrl: data.imgUrl,
|
||||||
|
width: 500,
|
||||||
|
height: 195,
|
||||||
|
caption: siteName,
|
||||||
|
},
|
||||||
|
image: {
|
||||||
|
"@id": `${mainUrl}/#primaryimage`,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Suspense fallback={<Loading />}>
|
<Suspense fallback={<Loading />}>
|
||||||
<>
|
<>
|
||||||
|
<script type="application/ld+json" dangerouslySetInnerHTML={{ __html: JSON.stringify(jsonLd) }} />
|
||||||
<HeroOther
|
<HeroOther
|
||||||
img={"/assets/images/full-width-images/section-bg-13.jpeg"}
|
img={"/assets/images/full-width-images/section-bg-13.jpeg"}
|
||||||
title={data.data.name}
|
title={data.data.name}
|
||||||
|
@ -3,6 +3,7 @@ import { RenderBlocks } from "@/components/Blocks/RenderBlocks";
|
|||||||
import BlogDetail from "@/components/Blogs/BlogDetail";
|
import BlogDetail from "@/components/Blogs/BlogDetail";
|
||||||
import { fetchPageBySlug } from "@/services/payload/page";
|
import { fetchPageBySlug } from "@/services/payload/page";
|
||||||
import HeroOther from "@/components/HeroOther";
|
import HeroOther from "@/components/HeroOther";
|
||||||
|
import { headers } from "next/headers";
|
||||||
|
|
||||||
export interface PageProps {
|
export interface PageProps {
|
||||||
slug: string | undefined;
|
slug: string | undefined;
|
||||||
@ -11,6 +12,7 @@ export interface PageProps {
|
|||||||
export default async function Page({ slug }: PageProps) {
|
export default async function Page({ slug }: PageProps) {
|
||||||
const page = await fetchPageBySlug({ slug });
|
const page = await fetchPageBySlug({ slug });
|
||||||
|
|
||||||
|
// if page is a blog post
|
||||||
if (!page) {
|
if (!page) {
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
@ -20,8 +22,88 @@ export default async function Page({ slug }: PageProps) {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// if page is not a blog post
|
||||||
|
const headersList = await headers();
|
||||||
|
const mainUrl = headersList.get("x-main-url");
|
||||||
|
const fullUrl = headersList.get("x-full-url");
|
||||||
|
const siteName = headersList.get("x-site-name");
|
||||||
|
const metaDesc = !!page?.meta?.description ? page.meta?.description : headersList.get("x-meta-desc");
|
||||||
|
|
||||||
|
const jsonLd = {
|
||||||
|
"@context": "https://schema.org",
|
||||||
|
"@graph": [
|
||||||
|
{
|
||||||
|
"@type": "WebPage",
|
||||||
|
"@id": fullUrl,
|
||||||
|
url: fullUrl,
|
||||||
|
name: `${page.meta?.title ?? ""} - ${siteName}`,
|
||||||
|
isPartOf: {
|
||||||
|
"@id": `${mainUrl}/#website`,
|
||||||
|
},
|
||||||
|
datePublished: page?.createdAt,
|
||||||
|
dateModified: page?.updatedAt,
|
||||||
|
description: metaDesc,
|
||||||
|
breadcrumb: {
|
||||||
|
"@id": `${fullUrl}#breadcrumb`,
|
||||||
|
},
|
||||||
|
inLanguage: "en-US",
|
||||||
|
potentialAction: [
|
||||||
|
{
|
||||||
|
"@type": "ReadAction",
|
||||||
|
target: [fullUrl],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"@type": "WebSite",
|
||||||
|
"@id": `${mainUrl}/#website`,
|
||||||
|
url: `${mainUrl}/`,
|
||||||
|
name: siteName,
|
||||||
|
description: "",
|
||||||
|
publisher: {
|
||||||
|
"@id": `${mainUrl}/#organization`,
|
||||||
|
},
|
||||||
|
potentialAction: [
|
||||||
|
{
|
||||||
|
"@type": "SearchAction",
|
||||||
|
target: {
|
||||||
|
"@type": "EntryPoint",
|
||||||
|
urlTemplate: `${mainUrl}/?s={search_term_string}`,
|
||||||
|
},
|
||||||
|
"query-input": {
|
||||||
|
"@type": "PropertyValueSpecification",
|
||||||
|
valueRequired: true,
|
||||||
|
valueName: "search_term_string",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
inLanguage: "en-US",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"@type": "Organization",
|
||||||
|
"@id": `${mainUrl}/#organization`,
|
||||||
|
name: siteName,
|
||||||
|
url: `${mainUrl}/`,
|
||||||
|
logo: {
|
||||||
|
"@type": "ImageObject",
|
||||||
|
inLanguage: "en-US",
|
||||||
|
"@id": `${mainUrl}/#/schema/logo/image/`,
|
||||||
|
url: `${mainUrl}/assets/images/logo-dark.webp`,
|
||||||
|
contentUrl: `${mainUrl}/assets/images/logo-dark.webp`,
|
||||||
|
width: 500,
|
||||||
|
height: 195,
|
||||||
|
caption: siteName,
|
||||||
|
},
|
||||||
|
image: {
|
||||||
|
"@id": `${mainUrl}/#/schema/logo/image/`,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
|
<script type="application/ld+json" dangerouslySetInnerHTML={{ __html: JSON.stringify(jsonLd) }} />
|
||||||
<HeroOther title={page.title} img={page?.heroImg?.url ?? ""} />
|
<HeroOther title={page.title} img={page?.heroImg?.url ?? ""} />
|
||||||
<RenderBlocks blocks={page.layout} />
|
<RenderBlocks blocks={page.layout} />
|
||||||
</>
|
</>
|
||||||
|
@ -8,6 +8,8 @@ export function middleware(request: NextRequest) {
|
|||||||
const host = request.headers.get("x-forwarded-host") || request.nextUrl.hostname;
|
const host = request.headers.get("x-forwarded-host") || request.nextUrl.hostname;
|
||||||
const path = request.nextUrl.pathname + request.nextUrl.search;
|
const path = request.nextUrl.pathname + request.nextUrl.search;
|
||||||
const siteName = "Cochise Oncology";
|
const siteName = "Cochise Oncology";
|
||||||
|
const metaDesc =
|
||||||
|
"Get compassionate care and excellent medical services from COCHISE ONCOLOGY in Sierra Vista, Arizona. We are the largest full-service cancer treatment center between Albuquerque, New Mexico and Tucson, Arizona.";
|
||||||
|
|
||||||
// Construct the full URL
|
// Construct the full URL
|
||||||
const mainUrl = `${protocol}://${host}`;
|
const mainUrl = `${protocol}://${host}`;
|
||||||
@ -15,6 +17,7 @@ export function middleware(request: NextRequest) {
|
|||||||
request.headers.set("x-main-url", mainUrl);
|
request.headers.set("x-main-url", mainUrl);
|
||||||
request.headers.set("x-full-url", fullUrl);
|
request.headers.set("x-full-url", fullUrl);
|
||||||
request.headers.set("x-site-name", siteName);
|
request.headers.set("x-site-name", siteName);
|
||||||
|
request.headers.set("x-meta-desc", metaDesc);
|
||||||
|
|
||||||
return NextResponse.next({
|
return NextResponse.next({
|
||||||
request: {
|
request: {
|
||||||
|
@ -6,10 +6,12 @@ export async function getDefaultMetadata(): Promise<Metadata> {
|
|||||||
const mainUrl = headersList.get("x-main-url") ?? "";
|
const mainUrl = headersList.get("x-main-url") ?? "";
|
||||||
const fullUrl = headersList.get("x-full-url") ?? "";
|
const fullUrl = headersList.get("x-full-url") ?? "";
|
||||||
const siteName = headersList.get("x-site-name") ?? "";
|
const siteName = headersList.get("x-site-name") ?? "";
|
||||||
|
const metaDesc = headersList.get("x-meta-desc") ?? "";
|
||||||
|
|
||||||
return {
|
return {
|
||||||
metadataBase: new URL(mainUrl),
|
metadataBase: new URL(mainUrl),
|
||||||
title: siteName,
|
title: siteName,
|
||||||
|
description: metaDesc,
|
||||||
robots: {
|
robots: {
|
||||||
index: true,
|
index: true,
|
||||||
follow: true,
|
follow: true,
|
||||||
@ -18,8 +20,9 @@ export async function getDefaultMetadata(): Promise<Metadata> {
|
|||||||
"max-video-preview": -1,
|
"max-video-preview": -1,
|
||||||
},
|
},
|
||||||
openGraph: {
|
openGraph: {
|
||||||
title: siteName,
|
|
||||||
siteName,
|
siteName,
|
||||||
|
title: siteName,
|
||||||
|
description: metaDesc,
|
||||||
type: "website",
|
type: "website",
|
||||||
locale: "en_US",
|
locale: "en_US",
|
||||||
url: fullUrl,
|
url: fullUrl,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user