lerobot/robot-learning-tutorial
508
1---2interface Props {3 title: string;4 description?: string;5 authors?: string[];6 published?: string;7 tags?: string[];8 image?: string; // Preferred absolute URL9}10 11const { title, description = '', authors = [], published, tags = [], image } = Astro.props as Props;12 13const url = Astro.url?.toString?.() ?? '';14const site = (Astro.site ? String(Astro.site) : '') as string;15 16const ogImage = image && image.length > 017 ? (image.startsWith('http') ? image : (site ? new URL(image, site).toString() : image))18 : undefined;19 20const jsonLd = {21 '@context': 'https://schema.org',22 '@type': 'Article',23 headline: title,24 description: description || undefined,25 datePublished: published || undefined,26 author: authors.map((name) => ({ '@type': 'Person', name })),27 keywords: tags.length ? tags.join(', ') : undefined,28 mainEntityOfPage: url || undefined,29 image: ogImage ? [ogImage] : undefined,30};31---32<title>{title}</title>33<meta name="description" content={description} />34<link rel="canonical" href={url} />35 36<meta property="og:type" content="article" />37<meta property="og:title" content={title} />38{description && <meta property="og:description" content={description} />}39<meta property="og:url" content={url} />40{ogImage && <meta property="og:image" content={ogImage} />}41{published && <meta property="article:published_time" content={published} />}42{authors.map(a => <meta property="article:author" content={a} />)}43 44<meta name="twitter:card" content={ogImage ? 'summary_large_image' : 'summary'} />45<meta name="twitter:title" content={title} />46{description && <meta name="twitter:description" content={description} />}47{ogImage && <meta name="twitter:image" content={ogImage} />}48 49<script type="application/ld+json" set:html={JSON.stringify(jsonLd)} />50 51 52 