Merged in fix/SW-1801-return-not-found-on-non-existing-routes (pull request #1462)

fix(SW-1801): Prevent resolving subpages for start page

* fix(SW-1801): Prevent resolving subpages for start page


Approved-by: Linus Flood
This commit is contained in:
Chuma Mcphoy (We Ahead)
2025-03-04 08:02:16 +00:00
parent 00fa7819b4
commit bbbfe48634

View File

@@ -43,6 +43,11 @@ export const middleware: NextMiddleware = async (request) => {
contentType = parentContentType
uid = parentUid
switch (parentContentType) {
// If the parent is the startpage, we should not be able to resolve a subpage.
case PageContentTypeEnum.startPage:
throw notFound(
`Unable to resolve CMS entry for page "${pathWithoutTrailingSlash}"`
)
case PageContentTypeEnum.hotelPage:
// E.g. Dedicated pages for restaurant, parking etc.
searchParams.set("subpage", subpage)