Merged in SW-3490-set-metadata-for-routes (pull request #2881)
SW-3490 set metadata for routes * feat(SW-3490): Set metadata title for hotelreservation paths Approved-by: Anton Gunnarsson
This commit is contained in:
@@ -2,8 +2,25 @@ import "@scandic-hotels/common/polyfills"
|
||||
|
||||
import { configureTrpc } from "@/lib/trpc"
|
||||
|
||||
import { getTitlePrefix } from "@/util/metadata/getTitlePrfiex"
|
||||
|
||||
import type { Metadata } from "next"
|
||||
|
||||
configureTrpc()
|
||||
|
||||
export async function generateMetadata(): Promise<Metadata> {
|
||||
return {
|
||||
title: {
|
||||
template: combineSegments([
|
||||
getTitlePrefix(),
|
||||
"%s",
|
||||
"SAS by Scandic Hotels",
|
||||
]),
|
||||
default: combineSegments([getTitlePrefix(), "SAS by Scandic Hotels"]),
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
export default function RootLayout({
|
||||
children,
|
||||
}: {
|
||||
@@ -11,3 +28,10 @@ export default function RootLayout({
|
||||
}) {
|
||||
return <>{children}</>
|
||||
}
|
||||
|
||||
function combineSegments(
|
||||
segments: (string | null | undefined)[],
|
||||
delimiter = " | "
|
||||
) {
|
||||
return segments.filter(Boolean).join(delimiter).trim()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user