import type {
ProjectRow,
ServiceRow,
SiteSettingsRow,
FaqItem,
} from "@/lib/types";
import { siteConfig } from "@/lib/site-config";
export function JsonLd({ data }: { data: object }) {
return (
);
}
export function OrganizationLd({
settings,
}: {
settings?: SiteSettingsRow | null;
}) {
const phone = settings?.contact_phone_raw ?? siteConfig.contact.phoneRaw;
const email = settings?.contact_email ?? siteConfig.contact.email;
const address = settings?.contact_address ?? siteConfig.contact.address;
const socials = [
settings?.social_linkedin,
settings?.social_instagram,
settings?.social_twitter,
settings?.social_facebook,
].filter(Boolean);
const data: Record = {
"@context": "https://schema.org",
"@type": "LocalBusiness",
"@id": `${siteConfig.url}/#organization`,
name: settings?.site_name ?? siteConfig.name,
description: settings?.footer_tagline ?? siteConfig.tagline,
url: siteConfig.url,
logo: `${siteConfig.url}/logo.png`,
image: `${siteConfig.url}/logo.png`,
telephone: phone,
email,
address: {
"@type": "PostalAddress",
streetAddress: address,
addressLocality: "İzmit",
addressRegion: "Kocaeli",
addressCountry: "TR",
},
areaServed: [
{ "@type": "City", name: "Kocaeli" },
{ "@type": "City", name: "İstanbul" },
{ "@type": "Country", name: "Türkiye" },
],
sameAs: socials,
};
if (settings?.google_rating && settings?.google_review_count) {
data.aggregateRating = {
"@type": "AggregateRating",
ratingValue: settings.google_rating,
reviewCount: settings.google_review_count,
bestRating: 5,
worstRating: 1,
};
}
return ;
}
export function ServiceLd({
service,
settings,
}: {
service: ServiceRow;
settings?: SiteSettingsRow | null;
}) {
return (
);
}
export function FaqLd({ items }: { items: FaqItem[] }) {
if (items.length === 0) return null;
return (
({
"@type": "Question",
name: it.q,
acceptedAnswer: {
"@type": "Answer",
text: it.a,
},
})),
}}
/>
);
}
export function BreadcrumbLd({
items,
}: {
items: { name: string; url: string }[];
}) {
return (
({
"@type": "ListItem",
position: i + 1,
name: it.name,
item: it.url,
})),
}}
/>
);
}
export function ArticleLd({ post }: { post: ProjectRow }) {
return (
);
}