// Site identity and structured data (JSON-LD) shared by the layout, the // home page and /llms.txt. Everything here is derived from the same data // the pages render (FAQS, STYLE_CATALOG, PRODUCTS), so search engines and // AI assistants are told exactly what a visitor sees. import { createElement } from 'react'; import { FAQS } from '../data/faqs'; import { STYLE_CATALOG } from '../data/styleCatalog'; import { PRODUCTS, type ProductId } from './pricing'; // Public origin. NEXT_PUBLIC_SITE_URL is per-environment (prod is // https://lumengesso.com); falls back to the canonical production URL. export const SITE_URL = (process.env.NEXT_PUBLIC_SITE_URL || 'https://lumengesso.com').replace(/\/$/, ''); export const SITE_NAME = 'Lumen & Gesso'; export const SITE_DESCRIPTION = 'Free, self-serve tools to upload, edit, and download your own pet portrait. No added watermark.'; export const CONTACT_EMAIL = 'hello@lumengesso.com'; export const SOCIAL_PROFILES = [ 'https://www.instagram.com/lumengesso/', 'https://www.pinterest.com/lumengesso/', ]; const ORG_ID = `${SITE_URL}/#studio`; const WEBSITE_ID = `${SITE_URL}/#website`; /** Style names as customers see them, without the lettered duplicates * (a style with an "x-plain" twin is the same style with the name added). */ export function styleNames(): string[] { const ids = new Set(STYLE_CATALOG.map((s) => s.id)); return STYLE_CATALOG.filter((s) => !ids.has(`${s.id}-plain` as typeof s.id)).map((s) => s.name); } /** Each product's name and lowest price, for listings and offers. */ export function productSummaries(): { id: ProductId; name: string; from: number }[] { return (Object.keys(PRODUCTS) as ProductId[]).map((id) => { const sizes = PRODUCTS[id].sizes as Record; return { id, name: PRODUCTS[id].label, from: Math.min(...Object.values(sizes).map((s) => s.price)) }; }); } /** Organization + WebSite, rendered on every page of the live site. */ export function siteJsonLd() { return { '@context': 'https://schema.org', '@graph': [ { '@type': 'Organization', '@id': ORG_ID, name: SITE_NAME, url: SITE_URL, logo: `${SITE_URL}/logo-1024.png`, description: SITE_DESCRIPTION, sameAs: SOCIAL_PROFILES, contactPoint: { '@type': 'ContactPoint', contactType: 'customer service', email: CONTACT_EMAIL, availableLanguage: ['English'], }, areaServed: 'Worldwide', }, { '@type': 'WebSite', '@id': WEBSITE_ID, url: SITE_URL, name: SITE_NAME, description: SITE_DESCRIPTION, publisher: { '@id': ORG_ID }, inLanguage: 'en-US', }, ], }; } /** Free self-service digital studio and FAQ. */ export function homeJsonLd() { return { '@context': 'https://schema.org', '@graph': [ { '@type': 'Service', '@id': `${SITE_URL}/#portrait-editor`, name: 'Free Portrait Studio', serviceType: 'Digital portrait editor', description: SITE_DESCRIPTION, provider: { '@id': ORG_ID }, url: `${SITE_URL}/studio`, }, { '@type': 'FAQPage', '@id': `${SITE_URL}/#faq`, mainEntity: FAQS.map(([q, a]) => ({ '@type': 'Question', name: q, acceptedAnswer: { '@type': 'Answer', text: a }, })), }, ], }; } /** Renders one JSON-LD block. `<` is escaped so text can't close the tag. */ export function JsonLd({ data }: { data: unknown }) { return createElement('script', { type: 'application/ld+json', dangerouslySetInnerHTML: { __html: JSON.stringify(data).replace(/