feat(BOOK-57): Adjusted metadata for destination pages with active seo filter

Approved-by: Chuma Mcphoy (We Ahead)
This commit is contained in:
Erik Tiekstra
2025-09-25 13:26:00 +00:00
parent 7714761c77
commit 9f02870647
20 changed files with 678 additions and 458 deletions
@@ -1,15 +1,31 @@
import { PageContentTypeEnum } from "@scandic-hotels/trpc/enums/contentType"
import { RTETypeEnum } from "@scandic-hotels/trpc/types/RTEenums"
import {
getDestinationCityPageDescription,
getDestinationCountryPageDescription,
getDestinationFilterSeoMetaDescription,
} from "@/utils/metadata/description/destinationPage"
import { truncateTextAfterLastPeriod } from "../truncate"
import { getDestinationCityPageDescription } from "./destinationCityPage"
import { getDestinationCountryPageDescription } from "./destinationCountryPage"
import { getHotelPageDescription } from "./hotelPage"
import type { RawMetadataSchema } from "@scandic-hotels/trpc/routers/contentstack/metadata/output"
export async function getDescription(data: RawMetadataSchema) {
const metadata = data.web?.seo_metadata
const isDestinationPage = [
PageContentTypeEnum.destinationCityPage,
PageContentTypeEnum.destinationCountryPage,
].includes(data.system.content_type_uid as PageContentTypeEnum)
if (isDestinationPage) {
const destinationFilterSeoMetaDescription =
getDestinationFilterSeoMetaDescription(data)
if (destinationFilterSeoMetaDescription) {
return destinationFilterSeoMetaDescription
}
}
if (metadata?.description) {
return metadata.description