Files
imen_pishghaman/shared/seo/schema.ts
T
S. EsmaeiliandClaude Opus 4.6 e31ef5a21f feat: migrate landing from Next.js to Nuxt 4 (Vue 3)
Full 1:1 migration preserving all visuals, animations and behavior:
- Nuxt 4 + Vue 3 (script setup, TypeScript strict) with SSG output
- Tailwind CSS v4 with @tailwindcss/vite
- Ant Design Vue 4 (dark theme, RTL, Persian locale) for design system
- Pinia for state management (ui + contact stores)
- motion-v (framer-motion port) for all animations
- lucide-vue-next for icons
- SEO improvements: og:image, canonical fix, real 404 page, JSON-LD services
- JS bundle reduced from 302KB to 239KB gzip
- Docker/nginx deployment preserved (out/ -> nginx)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-10-06 16:28:05 +03:30

69 lines
1.8 KiB
TypeScript

import { absUrl as abs, siteConfig as s } from "../config/site";
type Json = Record<string, unknown>;
const clean = <T extends object>(o: T): Json =>
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,
alternateName: s.nameEn,
url: abs("/"),
logo: abs(s.logo),
image: abs(s.logo),
description: s.description,
email: s.contact.email,
telephone: s.contact.phone,
foundingDate: s.foundingDate,
areaServed: s.areaServed,
address: {
"@type": "PostalAddress",
streetAddress: s.contact.address.streetAddress,
addressLocality: s.contact.address.addressLocality,
addressCountry: s.contact.address.addressCountry,
},
openingHoursSpecification: {
"@type": "OpeningHoursSpecification",
dayOfWeek: s.openingHours.days,
opens: s.openingHours.opens,
closes: s.openingHours.closes,
},
sameAs: s.socials,
});
export const websiteSchema = () => ({
"@context": "https://schema.org",
"@type": "WebSite",
"@id": `${s.url}/#website`,
url: abs("/"),
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 ?? s.areaServed,
provider: { "@id": `${s.url}/#organization` },
});
/** Serialize JSON-LD safely for an inline <script> (escape "<"). */
export const toJsonLd = (data: Json) =>
JSON.stringify(data).replace(/</g, "\\u003c");