feat(BOOK-57): Adjusted metadata for destination pages with active seo filter
Approved-by: Chuma Mcphoy (We Ahead)
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user