From bab7c15424efccfe6e10f86ef49b3d1bb95a0e2d Mon Sep 17 00:00:00 2001 From: Erik Tiekstra Date: Mon, 18 Nov 2024 15:47:28 +0100 Subject: [PATCH] feat(SW-201): Added structured data for hotel pages --- components/ContentType/HotelPage/index.tsx | 19 +++-- i18n/dictionaries/da.json | 1 + i18n/dictionaries/de.json | 1 + i18n/dictionaries/en.json | 4 +- i18n/dictionaries/fi.json | 1 + i18n/dictionaries/no.json | 1 + i18n/dictionaries/sv.json | 1 + .../routers/contentstack/metadata/output.ts | 12 +-- server/routers/contentstack/metadata/query.ts | 24 +----- server/routers/contentstack/metadata/utils.ts | 20 +++-- server/routers/hotels/output.ts | 82 ++++++++++--------- utils/jsonSchemas.ts | 54 +++++++++++- 12 files changed, 137 insertions(+), 83 deletions(-) diff --git a/components/ContentType/HotelPage/index.tsx b/components/ContentType/HotelPage/index.tsx index f5acca331..09143ce01 100644 --- a/components/ContentType/HotelPage/index.tsx +++ b/components/ContentType/HotelPage/index.tsx @@ -12,42 +12,43 @@ import SidePeek from "@/components/TempDesignSystem/SidePeek" import { getIntl } from "@/i18n" import { getLang } from "@/i18n/serverContext" import { getRestaurantHeading } from "@/utils/facilityCards" +import { generateHotelSchema } from "@/utils/jsonSchemas" import DynamicMap from "./Map/DynamicMap" import MapCard from "./Map/MapCard" import MapWithCardWrapper from "./Map/MapWithCard" import MobileMapToggle from "./Map/MobileMapToggle" import StaticMap from "./Map/StaticMap" -import WellnessAndExerciseSidePeek from "./SidePeeks/WellnessAndExercise" import AmenitiesList from "./AmenitiesList" import Facilities from "./Facilities" import IntroSection from "./IntroSection" import PreviewImages from "./PreviewImages" import { Rooms } from "./Rooms" -import { AboutTheHotelSidePeek } from "./SidePeeks" +import { AboutTheHotelSidePeek, WellnessAndExerciseSidePeek } from "./SidePeeks" import TabNavigation from "./TabNavigation" import styles from "./hotelPage.module.css" import { FacilityCardTypeEnum } from "@/types/components/hotelPage/facilities" -import { HotelPageProps } from "@/types/components/hotelPage/hotelPage" +import type { HotelPageProps } from "@/types/components/hotelPage/hotelPage" import { HotelHashValues } from "@/types/components/hotelPage/tabNavigation" -import { Facility } from "@/types/hotel" +import type { Facility } from "@/types/hotel" export default async function HotelPage({ hotelId }: HotelPageProps) { - const googleMapsApiKey = env.GOOGLE_STATIC_MAP_KEY - const googleMapId = env.GOOGLE_DYNAMIC_MAP_ID const lang = getLang() const [intl, hotelPageData, hotelData] = await Promise.all([ getIntl(), getHotelPage(), getHotelData({ hotelId, language: lang }), ]) + const googleMapsApiKey = env.GOOGLE_STATIC_MAP_KEY + const googleMapId = env.GOOGLE_DYNAMIC_MAP_ID if (!hotelData?.data || !hotelPageData) { return notFound() } + const jsonSchema = generateHotelSchema(hotelData.data.attributes) const { faq, content } = hotelPageData const { name, @@ -103,6 +104,12 @@ export default async function HotelPage({ hotelId }: HotelPageProps) { return (
+