Merged in feature/SW-2320-languagebased-hide-for-next-release (pull request #1937)

Language based alternative to HIDE_FOR_NEXT_RELEASE

Approved-by: Anton Gunnarsson
This commit is contained in:
Joakim Jäderberg
2025-05-05 10:53:28 +00:00
parent 3bcf6cff4a
commit 5784822a1e
41 changed files with 232 additions and 133 deletions

View File

@@ -1,7 +1,5 @@
import { type NextMiddleware, NextResponse } from "next/server"
import { notFound } from "@/server/errors/next"
import { getUidAndContentTypeByPath } from "@/services/cms/getUidAndContentTypeByPath"
import { findLang } from "@/utils/languages"
import { removeTrailingSlash } from "@/utils/url"
@@ -29,7 +27,7 @@ export const middleware: NextMiddleware = async (request) => {
if (!contentType || !uid) {
// Routes to subpages we need to check if the parent of the incomingPathName exists.
// Then we considered the incomingPathName to be a subpage. These subpages do not live in the CMS.
// Then we considered the incomingPathName to be a subpage. These subpages do NOT_LIVE in the CMS.
const incomingPathNameParts = incomingPathName.split("/")
// If the incomingPathName has 2 or more parts, it could possibly be a subpage.