Initial commit: Persian safety workwear landing page (Next.js)
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,53 @@
|
||||
import { siteConfig as s } from "@/config/site";
|
||||
|
||||
const abs = (p: string) => new URL(p, s.url).toString();
|
||||
const clean = <T extends object>(o: T) =>
|
||||
JSON.parse(
|
||||
JSON.stringify(o, (_, v) =>
|
||||
v === "" || (Array.isArray(v) && !v.length) ? undefined : v,
|
||||
),
|
||||
);
|
||||
|
||||
export const organizationSchema = () =>
|
||||
clean({
|
||||
"@context": "https://schema.org",
|
||||
"@type": "LocalBusiness",
|
||||
"@id": `${s.url}/#organization`,
|
||||
name: s.name,
|
||||
url: s.url,
|
||||
logo: abs(s.logo),
|
||||
image: abs(s.logo),
|
||||
email: s.contact.email,
|
||||
telephone: s.contact.phone,
|
||||
address: {
|
||||
"@type": "PostalAddress",
|
||||
streetAddress: s.contact.address.streetAddress,
|
||||
addressLocality: s.contact.address.addressLocality,
|
||||
addressCountry: s.contact.address.addressCountry,
|
||||
},
|
||||
sameAs: s.socials,
|
||||
});
|
||||
|
||||
export const websiteSchema = () => ({
|
||||
"@context": "https://schema.org",
|
||||
"@type": "WebSite",
|
||||
"@id": `${s.url}/#website`,
|
||||
url: s.url,
|
||||
name: s.name,
|
||||
inLanguage: s.lang,
|
||||
publisher: { "@id": `${s.url}/#organization` },
|
||||
});
|
||||
|
||||
export const serviceSchema = (opts: {
|
||||
name: string;
|
||||
description: string;
|
||||
areaServed?: string;
|
||||
}) =>
|
||||
clean({
|
||||
"@context": "https://schema.org",
|
||||
"@type": "Service",
|
||||
name: opts.name,
|
||||
description: opts.description,
|
||||
areaServed: opts.areaServed,
|
||||
provider: { "@id": `${s.url}/#organization` },
|
||||
});
|
||||
Reference in New Issue
Block a user