(sample: SampleRecord)
| 140 | } |
| 141 | |
| 142 | function buildSampleMetadata(sample: SampleRecord): PageMetadata { |
| 143 | return { |
| 144 | title: sample.metaTitle, |
| 145 | description: sample.metaDescription, |
| 146 | canonicalUrl: sample.canonicalUrl, |
| 147 | ogType: 'article', |
| 148 | ogImageUrl: sample.ogImageUrl, |
| 149 | ogImageAlt: DEFAULT_OG_IMAGE_ALT, |
| 150 | structuredData: [ |
| 151 | { |
| 152 | '@context': 'https://schema.org', |
| 153 | '@type': 'SoftwareSourceCode', |
| 154 | name: sample.title, |
| 155 | description: sample.metaDescription, |
| 156 | url: sample.canonicalUrl, |
| 157 | codeRepository: sample.githubCodeUrl, |
| 158 | programmingLanguage: sample.language, |
| 159 | keywords: sample.tags.join(', '), |
| 160 | about: sample.features |
| 161 | }, |
| 162 | { |
| 163 | ...buildBreadcrumbStructuredData([ |
| 164 | { name: 'Code Samples', item: SITE_URL }, |
| 165 | { name: sample.title, item: sample.canonicalUrl } |
| 166 | ]) |
| 167 | } |
| 168 | ] |
| 169 | }; |
| 170 | } |
| 171 | |
| 172 | function buildPatternMetadata(pattern: ResolvedPatternMapping): PageMetadata { |
| 173 | const canonicalUrl = `${SITE_URL}patterns/${pattern.id}/`; |
no test coverage detected