| 263 | } |
| 264 | |
| 265 | export function buildRouteHead(metadata: PageMetadata) { |
| 266 | return { |
| 267 | title: metadata.title, |
| 268 | meta: [ |
| 269 | { name: 'description', content: metadata.description }, |
| 270 | { property: 'og:type', content: metadata.ogType }, |
| 271 | { property: 'og:title', content: metadata.title }, |
| 272 | { property: 'og:description', content: metadata.description }, |
| 273 | { property: 'og:url', content: metadata.canonicalUrl }, |
| 274 | { property: 'og:image', content: metadata.ogImageUrl }, |
| 275 | { property: 'og:image:type', content: 'image/png' }, |
| 276 | { property: 'og:image:width', content: String(SOCIAL_CARD_WIDTH) }, |
| 277 | { property: 'og:image:height', content: String(SOCIAL_CARD_HEIGHT) }, |
| 278 | { property: 'og:image:alt', content: metadata.ogImageAlt }, |
| 279 | { name: 'twitter:card', content: 'summary_large_image' }, |
| 280 | { name: 'twitter:title', content: metadata.title }, |
| 281 | { name: 'twitter:description', content: metadata.description }, |
| 282 | { name: 'twitter:image', content: metadata.ogImageUrl }, |
| 283 | { name: 'twitter:image:alt', content: metadata.ogImageAlt }, |
| 284 | ...(metadata.robots ? [{ name: 'robots', content: metadata.robots }] : []) |
| 285 | ], |
| 286 | link: [{ rel: 'canonical', href: metadata.canonicalUrl }], |
| 287 | script: |
| 288 | metadata.structuredData.length > 0 |
| 289 | ? [ |
| 290 | { |
| 291 | id: 'app-structured-data', |
| 292 | type: 'application/ld+json', |
| 293 | textContent: JSON.stringify( |
| 294 | metadata.structuredData.length === 1 ? metadata.structuredData[0] : metadata.structuredData |
| 295 | ) |
| 296 | } |
| 297 | ] |
| 298 | : [] |
| 299 | }; |
| 300 | } |