feat(SW-2408): Improved meta titles for Hotel subpages
Approved-by: Matilda Landström
This commit is contained in:
@@ -15,7 +15,7 @@ export async function getTitle(data: RawMetadataSchema) {
|
|||||||
(restaurant) => restaurant.nameInUrl === data.subpageUrl
|
(restaurant) => restaurant.nameInUrl === data.subpageUrl
|
||||||
)
|
)
|
||||||
if (restaurantSubPage) {
|
if (restaurantSubPage) {
|
||||||
return intl.formatMessage(
|
const restaurantTitleLong = intl.formatMessage(
|
||||||
{
|
{
|
||||||
defaultMessage:
|
defaultMessage:
|
||||||
"Explore {restaurantName} at {hotelName} in {destination}",
|
"Explore {restaurantName} at {hotelName} in {destination}",
|
||||||
@@ -26,11 +26,44 @@ export async function getTitle(data: RawMetadataSchema) {
|
|||||||
destination: data.hotelData.address.city,
|
destination: data.hotelData.address.city,
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
const restaurantTitleShort = intl.formatMessage(
|
||||||
|
{
|
||||||
|
defaultMessage: "Explore {restaurantName} at {hotelName}",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
restaurantName: restaurantSubPage.name,
|
||||||
|
hotelName: data.hotelData.name,
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
if (restaurantTitleLong.length > 60) {
|
||||||
|
return restaurantTitleShort
|
||||||
|
}
|
||||||
|
return restaurantTitleLong
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (data.subpageUrl) {
|
switch (data.subpageUrl) {
|
||||||
|
case "reviews":
|
||||||
|
const reviewsTitleLong = intl.formatMessage(
|
||||||
|
{
|
||||||
|
defaultMessage:
|
||||||
|
"Ratings and reviews for {hotelName} in {destination}",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
hotelName: data.hotelData.name,
|
||||||
|
destination: data.hotelData.address.city,
|
||||||
|
}
|
||||||
|
)
|
||||||
|
const reviewsTitleShort = intl.formatMessage(
|
||||||
|
{ defaultMessage: "Ratings and reviews for {hotelName}" },
|
||||||
|
{ hotelName: data.hotelData.name }
|
||||||
|
)
|
||||||
|
if (reviewsTitleLong.length > 60) {
|
||||||
|
return reviewsTitleShort
|
||||||
|
}
|
||||||
|
return reviewsTitleLong
|
||||||
case data.additionalHotelData?.hotelParking.nameInUrl:
|
case data.additionalHotelData?.hotelParking.nameInUrl:
|
||||||
return intl.formatMessage(
|
const parkingTitleLong = intl.formatMessage(
|
||||||
{
|
{
|
||||||
defaultMessage:
|
defaultMessage:
|
||||||
"Parking information for {hotelName} in {destination}",
|
"Parking information for {hotelName} in {destination}",
|
||||||
@@ -40,8 +73,17 @@ export async function getTitle(data: RawMetadataSchema) {
|
|||||||
destination: data.hotelData.address.city,
|
destination: data.hotelData.address.city,
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
const parkingTitleShort = intl.formatMessage(
|
||||||
|
{ defaultMessage: "Parking information for {hotelName}" },
|
||||||
|
{ hotelName: data.hotelData.name }
|
||||||
|
)
|
||||||
|
|
||||||
|
if (parkingTitleLong.length > 60) {
|
||||||
|
return parkingTitleShort
|
||||||
|
}
|
||||||
|
return parkingTitleLong
|
||||||
case data.additionalHotelData?.healthAndFitness.nameInUrl:
|
case data.additionalHotelData?.healthAndFitness.nameInUrl:
|
||||||
return intl.formatMessage(
|
const wellnessTitleLong = intl.formatMessage(
|
||||||
{
|
{
|
||||||
defaultMessage:
|
defaultMessage:
|
||||||
"Gym & Health Facilities at {hotelName} in {destination}",
|
"Gym & Health Facilities at {hotelName} in {destination}",
|
||||||
@@ -51,8 +93,21 @@ export async function getTitle(data: RawMetadataSchema) {
|
|||||||
destination: data.hotelData.address.city,
|
destination: data.hotelData.address.city,
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
const wellnessTitleShort = intl.formatMessage(
|
||||||
|
{
|
||||||
|
defaultMessage: "Gym & Health Facilities at {hotelName}",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
hotelName: data.hotelData.name,
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
if (wellnessTitleLong.length > 60) {
|
||||||
|
return wellnessTitleShort
|
||||||
|
}
|
||||||
|
return wellnessTitleLong
|
||||||
case data.additionalHotelData?.hotelSpecialNeeds.nameInUrl:
|
case data.additionalHotelData?.hotelSpecialNeeds.nameInUrl:
|
||||||
return intl.formatMessage(
|
const accessibilityTitleLong = intl.formatMessage(
|
||||||
{
|
{
|
||||||
defaultMessage:
|
defaultMessage:
|
||||||
"Accessibility information for {hotelName} in {destination}",
|
"Accessibility information for {hotelName} in {destination}",
|
||||||
@@ -62,17 +117,43 @@ export async function getTitle(data: RawMetadataSchema) {
|
|||||||
destination: data.hotelData.address.city,
|
destination: data.hotelData.address.city,
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
const accessibilityTitleShort = intl.formatMessage(
|
||||||
|
{
|
||||||
|
defaultMessage: "Accessibility information for {hotelName}",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
hotelName: data.hotelData.name,
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
if (accessibilityTitleLong.length > 60) {
|
||||||
|
return accessibilityTitleShort
|
||||||
|
}
|
||||||
|
return accessibilityTitleLong
|
||||||
case data.additionalHotelData?.meetingRooms.nameInUrl:
|
case data.additionalHotelData?.meetingRooms.nameInUrl:
|
||||||
return intl.formatMessage(
|
const meetingsTitleLong = intl.formatMessage(
|
||||||
{
|
{
|
||||||
defaultMessage:
|
defaultMessage:
|
||||||
"Meetings, Conferences & Events at {hotelName} in {destination}",
|
"Meetings & Conferences at {hotelName} in {destination}",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
hotelName: data.hotelData.name,
|
hotelName: data.hotelData.name,
|
||||||
destination: data.hotelData.address.city,
|
destination: data.hotelData.address.city,
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
const meetingsTitleShort = intl.formatMessage(
|
||||||
|
{
|
||||||
|
defaultMessage: "Meetings & Conferences at {hotelName}",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
hotelName: data.hotelData.name,
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
if (meetingsTitleLong.length > 60) {
|
||||||
|
return meetingsTitleShort
|
||||||
|
}
|
||||||
|
return meetingsTitleLong
|
||||||
default:
|
default:
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user