Lumen & Gesso / website · lumengesso.com / app / lib / seo.ts
| 1 | // Site identity and structured data (JSON-LD) shared by the layout, the |
| 2 | // home page and /llms.txt. Everything here is derived from the same data |
| 3 | // the pages render (FAQS, STYLE_CATALOG, PRODUCTS), so search engines and |
| 4 | // AI assistants are told exactly what a visitor sees. |
| 5 | import { createElement } from 'react'; |
| 6 | import { FAQS } from '../data/faqs'; |
| 7 | import { STYLE_CATALOG } from '../data/styleCatalog'; |
| 8 | import { PRODUCTS, type ProductId } from './pricing'; |
| 9 | |
| 10 | // Public origin. NEXT_PUBLIC_SITE_URL is per-environment (prod is |
| 11 | // https://lumengesso.com); falls back to the canonical production URL. |
| 12 | export const SITE_URL = (process.env.NEXT_PUBLIC_SITE_URL || 'https://lumengesso.com').replace(/\/$/, ''); |
| 13 | export const SITE_NAME = 'Lumen & Gesso'; |
| 14 | export const SITE_DESCRIPTION = |
| 15 | 'Free, self-serve tools to upload, edit, and download your own pet portrait. No added watermark.'; |
| 16 | export const CONTACT_EMAIL = 'hello@lumengesso.com'; |
| 17 | export const SOCIAL_PROFILES = [ |
| 18 | 'https://www.instagram.com/lumengesso/', |
| 19 | 'https://www.pinterest.com/lumengesso/', |
| 20 | ]; |
| 21 | |
| 22 | const ORG_ID = `${SITE_URL}/#studio`; |
| 23 | const WEBSITE_ID = `${SITE_URL}/#website`; |
| 24 | |
| 25 | /** Style names as customers see them, without the lettered duplicates |
| 26 | * (a style with an "x-plain" twin is the same style with the name added). */ |
| 27 | export function styleNames(): string[] { |
| 28 | const ids = new Set(STYLE_CATALOG.map((s) => s.id)); |
| 29 | return STYLE_CATALOG.filter((s) => !ids.has(`${s.id}-plain` as typeof s.id)).map((s) => s.name); |
| 30 | } |
| 31 | |
| 32 | /** Each product's name and lowest price, for listings and offers. */ |
| 33 | export function productSummaries(): { id: ProductId; name: string; from: number }[] { |
| 34 | return (Object.keys(PRODUCTS) as ProductId[]).map((id) => { |
| 35 | const sizes = PRODUCTS[id].sizes as Record<string, { price: number }>; |
| 36 | return { id, name: PRODUCTS[id].label, from: Math.min(...Object.values(sizes).map((s) => s.price)) }; |
| 37 | }); |
| 38 | } |
| 39 | |
| 40 | /** Organization + WebSite, rendered on every page of the live site. */ |
| 41 | export function siteJsonLd() { |
| 42 | return { |
| 43 | '@context': 'https://schema.org', |
| 44 | '@graph': [ |
| 45 | { |
| 46 | '@type': 'Organization', |
| 47 | '@id': ORG_ID, |
| 48 | name: SITE_NAME, |
| 49 | url: SITE_URL, |
| 50 | logo: `${SITE_URL}/logo-1024.png`, |
| 51 | description: SITE_DESCRIPTION, |
| 52 | sameAs: SOCIAL_PROFILES, |
| 53 | contactPoint: { |
| 54 | '@type': 'ContactPoint', |
| 55 | contactType: 'customer service', |
| 56 | email: CONTACT_EMAIL, |
| 57 | availableLanguage: ['English'], |
| 58 | }, |
| 59 | areaServed: 'Worldwide', |
| 60 | }, |
| 61 | { |
| 62 | '@type': 'WebSite', |
| 63 | '@id': WEBSITE_ID, |
| 64 | url: SITE_URL, |
| 65 | name: SITE_NAME, |
| 66 | description: SITE_DESCRIPTION, |
| 67 | publisher: { '@id': ORG_ID }, |
| 68 | inLanguage: 'en-US', |
| 69 | }, |
| 70 | ], |
| 71 | }; |
| 72 | } |
| 73 | |
| 74 | /** Free self-service digital studio and FAQ. */ |
| 75 | export function homeJsonLd() { |
| 76 | return { |
| 77 | '@context': 'https://schema.org', |
| 78 | '@graph': [ |
| 79 | { |
| 80 | '@type': 'Service', |
| 81 | '@id': `${SITE_URL}/#portrait-editor`, |
| 82 | name: 'Free Portrait Studio', |
| 83 | serviceType: 'Digital portrait editor', |
| 84 | description: SITE_DESCRIPTION, |
| 85 | provider: { '@id': ORG_ID }, |
| 86 | url: `${SITE_URL}/studio`, |
| 87 | }, |
| 88 | { |
| 89 | '@type': 'FAQPage', |
| 90 | '@id': `${SITE_URL}/#faq`, |
| 91 | mainEntity: FAQS.map(([q, a]) => ({ |
| 92 | '@type': 'Question', |
| 93 | name: q, |
| 94 | acceptedAnswer: { '@type': 'Answer', text: a }, |
| 95 | })), |
| 96 | }, |
| 97 | ], |
| 98 | }; |
| 99 | } |
| 100 | |
| 101 | /** Renders one JSON-LD block. `<` is escaped so text can't close the tag. */ |
| 102 | export function JsonLd({ data }: { data: unknown }) { |
| 103 | return createElement('script', { |
| 104 | type: 'application/ld+json', |
| 105 | dangerouslySetInnerHTML: { __html: JSON.stringify(data).replace(/</g, '\\u003c') }, |
| 106 | }); |
| 107 | } |