feat(SW-201): Added hotel metadata
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import { z } from "zod"
|
||||
|
||||
import { tempImageVaultAssetSchema } from "../schemas/imageVault"
|
||||
import { getDescription, getImages, getTitle } from "./utils"
|
||||
import { getDescription, getImage, getTitle } from "./utils"
|
||||
|
||||
import type { Metadata } from "next"
|
||||
|
||||
@@ -71,16 +71,26 @@ export const rawMetadataSchema = z.object({
|
||||
.nullable(),
|
||||
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(),
|
||||
})
|
||||
.optional()
|
||||
.nullable(),
|
||||
})
|
||||
|
||||
export const metadataSchema = rawMetadataSchema.transform((data) => {
|
||||
export const metadataSchema = rawMetadataSchema.transform(async (data) => {
|
||||
const noIndex = !!data.web?.seo_metadata?.noindex
|
||||
|
||||
const metadata: Metadata = {
|
||||
title: getTitle(data),
|
||||
description: getDescription(data),
|
||||
title: await getTitle(data),
|
||||
description: await getDescription(data),
|
||||
openGraph: {
|
||||
images: getImages(data),
|
||||
images: getImage(data),
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user