feat(SW-201): Added structured data for hotel pages

This commit is contained in:
Erik Tiekstra
2024-11-18 15:47:28 +01:00
parent ca2f60253f
commit bab7c15424
12 changed files with 137 additions and 83 deletions

View File

@@ -1,5 +1,6 @@
import { z } from "zod"
import { hotelAttributesSchema } from "../../hotels/output"
import { tempImageVaultAssetSchema } from "../schemas/imageVault"
import { getDescription, getImage, getTitle } from "./utils"
@@ -72,13 +73,8 @@ export const rawMetadataSchema = z.object({
hero_image: tempImageVaultAssetSchema.nullable(),
blocks: metaDataBlocksSchema,
hotel_page_id: z.string().optional().nullable(),
hotelData: z
.object({
name: z.string(),
city: z.string(),
description: z.string(),
image: z.object({ url: z.string(), alt: z.string() }).nullable(),
})
hotelData: hotelAttributesSchema
.pick({ name: true, address: true, hotelContent: true, gallery: true })
.optional()
.nullable(),
})
@@ -88,7 +84,7 @@ export const metadataSchema = rawMetadataSchema.transform(async (data) => {
const metadata: Metadata = {
title: await getTitle(data),
description: await getDescription(data),
description: getDescription(data),
openGraph: {
images: getImage(data),
},