feat(SW-266): Replacing static metadata with data from Contentstack on Loyalty pages and Account Pages
This commit is contained in:
@@ -1,9 +1,12 @@
|
||||
import { notFound } from "next/navigation"
|
||||
|
||||
import { serverClient } from "@/lib/trpc/server"
|
||||
|
||||
import ContentPage from "@/components/ContentType/ContentPage"
|
||||
import HotelPage from "@/components/ContentType/HotelPage/HotelPage"
|
||||
import LoyaltyPage from "@/components/ContentType/LoyaltyPage/LoyaltyPage"
|
||||
import { setLang } from "@/i18n/serverContext"
|
||||
import { generateMetadata as generateBaseMetadata } from "@/utils/generateMetadata"
|
||||
|
||||
import {
|
||||
ContentTypeParams,
|
||||
@@ -12,6 +15,22 @@ import {
|
||||
UIDParams,
|
||||
} from "@/types/params"
|
||||
|
||||
export async function generateMetadata({
|
||||
params,
|
||||
}: PageArgs<LangParams & ContentTypeParams>) {
|
||||
switch (params.contentType) {
|
||||
case "loyalty-page":
|
||||
const loyaltyPageRes = await serverClient().contentstack.loyaltyPage.get()
|
||||
return generateBaseMetadata({
|
||||
params,
|
||||
pageTitle: loyaltyPageRes?.loyaltyPage?.title,
|
||||
})
|
||||
// Add case "hotel-pages" etc when needed
|
||||
default:
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
export default async function ContentTypePage({
|
||||
params,
|
||||
}: PageArgs<LangParams & ContentTypeParams & UIDParams, {}>) {
|
||||
|
||||
Reference in New Issue
Block a user