Extract admin dashboard from ghabilee-frontend2 into a dedicated Next.js app for backoffice.ghabilee.ir (no SEO indexing / Clarity).
40 lines
953 B
TypeScript
40 lines
953 B
TypeScript
import type { Metadata } from 'next'
|
|
|
|
import { buildCanonicalUrl, resolveOgImage } from '@/lib/seo/metadata'
|
|
|
|
export function buildPublicPageMetadata({
|
|
path,
|
|
metaTitle,
|
|
metaDescription,
|
|
ogImage,
|
|
}: {
|
|
path: string
|
|
metaTitle: string
|
|
metaDescription: string
|
|
ogImage?: string
|
|
}): Metadata {
|
|
const canonical = path.startsWith('/') ? path : `/${path}`
|
|
const url = buildCanonicalUrl(canonical)
|
|
const image = ogImage?.startsWith('http') ? ogImage : ogImage ? buildCanonicalUrl(ogImage) : resolveOgImage()
|
|
|
|
return {
|
|
title: metaTitle,
|
|
description: metaDescription,
|
|
alternates: { canonical },
|
|
openGraph: {
|
|
type: 'website',
|
|
title: metaTitle,
|
|
description: metaDescription,
|
|
url,
|
|
locale: 'fa_IR',
|
|
images: [{ url: image, alt: metaTitle }],
|
|
},
|
|
twitter: {
|
|
card: 'summary_large_image',
|
|
title: metaTitle,
|
|
description: metaDescription,
|
|
images: [image],
|
|
},
|
|
}
|
|
}
|