--- interface Props { title: string; description?: string; authors?: string[]; published?: string; modified?: string; tags?: string[]; image?: string; // Preferred absolute URL } const { title, description = "", authors = [], published, modified, tags = [], image, } = Astro.props as Props; const url = Astro.url?.toString?.() ?? ""; const site = (Astro.site ? String(Astro.site) : "") as string; // Build base URL: prefer Astro.site, fallback to origin from Astro.url const baseUrl = site || (Astro.url ? `${Astro.url.protocol}//${Astro.url.host}` : ""); const ogImage = image && image.length > 0 ? image.startsWith("http") ? image : baseUrl ? new URL(image, baseUrl).toString() : image : undefined; const jsonLd = { "@context": "https://schema.org", "@type": "Article", headline: title, description: description || undefined, datePublished: published || undefined, dateModified: modified || published || undefined, author: authors.map((name) => ({ "@type": "Person", name })), publisher: { "@type": "Organization", name: "Hugging Face", url: "https://huggingface.co", }, keywords: tags.length ? tags.join(", ") : undefined, mainEntityOfPage: url || undefined, image: ogImage ? [ogImage] : undefined, }; ---