Merged in fix/get-from-contentstack (pull request #1378)
* fix: include lang when fetching from contentstack Approved-by: Matilda Landström
This commit is contained in:
@@ -26,14 +26,15 @@ export const middleware: NextMiddleware = async (request) => {
|
|||||||
? contentTypePathName.replace("/preview", "")
|
? contentTypePathName.replace("/preview", "")
|
||||||
: contentTypePathName
|
: contentTypePathName
|
||||||
|
|
||||||
let { contentType, uid } = await getUidAndContentTypeByPath(incomingPathName)
|
let { contentType, uid } = await getUidAndContentTypeByPath(
|
||||||
|
pathWithoutTrailingSlash
|
||||||
|
)
|
||||||
|
|
||||||
const searchParams = new URLSearchParams(request.nextUrl.searchParams)
|
const searchParams = new URLSearchParams(request.nextUrl.searchParams)
|
||||||
|
|
||||||
if (!contentType || !uid) {
|
if (!contentType || !uid) {
|
||||||
// Routes to subpages we need to check if the parent of the incomingPathName exists.
|
// 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("/")
|
const incomingPathNameParts = incomingPathName.split("/")
|
||||||
|
|
||||||
// If the incomingPathName has 2 or more parts, it could possibly be a subpage.
|
// If the incomingPathName has 2 or more parts, it could possibly be a subpage.
|
||||||
|
|||||||
Reference in New Issue
Block a user