From 4893d925c5b2679989714346d1594fe662eb4e17 Mon Sep 17 00:00:00 2001 From: Sebastian Frank Date: Thu, 30 Oct 2025 09:32:06 +0000 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=A7=20fix:=20comment=20out=20unused=20?= =?UTF-8?q?SSR=20path=20validation=20logic=20and=20update=20collection=20c?= =?UTF-8?q?heck?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/hooks/config.js | 56 +++++++++++++++++++++++---------------------- 1 file changed, 29 insertions(+), 27 deletions(-) diff --git a/api/hooks/config.js b/api/hooks/config.js index 6b2715e..105b0ac 100644 --- a/api/hooks/config.js +++ b/api/hooks/config.js @@ -35,39 +35,41 @@ module.exports = { // validate if path ssr rendering is ok, -1 = NOTFOUND, 0 = NO SSR, 1 = SSR // pe. use context.readCollection("product", {filter: {path: path}}) ... to validate dynamic urls - // / is fixed url - if (path == "/cart") return 1 + // // / is fixed url + // if (path == "/cart") return 1 - // path starts with /products/ is product - if (path?.startsWith("/products/")) { - const slug = path?.replace(/^\/products\//, "") - const resp = context.db.find("product", { - filter: { - $and: [{ slug: slug }, publishedFilter], - }, + // // path starts with /products/ is product + // if (path?.startsWith("/products/")) { + // const slug = path?.replace(/^\/products\//, "") + // const resp = context.db.find("product", { + // filter: { + // $and: [{ slug: slug }, publishedFilter], + // }, - selector: { _id: 1 }, - }) - if (resp && resp.length) { - return 1 - } - } + // selector: { _id: 1 }, + // }) + // if (resp && resp.length) { + // return 1 + // } + // } - // // all other sites are in db - //path = path?.replace(/^\//, "") - const resp = context.db.find("content", { - filter: { - $and: [{ $or: [{ path }, { "alternativePaths.path": path }] }, publishedFilter], - }, + // // // all other sites are in db + // //path = path?.replace(/^\//, "") + // const resp = context.db.find("content", { + // filter: { + // $and: [{ $or: [{ path }, { "alternativePaths.path": path }] }, publishedFilter], + // }, - selector: { _id: 1 }, - }) - if (resp && resp.length) { - return 1 - } + // selector: { _id: 1 }, + // }) + // if (resp && resp.length) { + // return 1 + // } // not found return -1 }, - ssrPublishCheckCollections: ["content", "product"], + ssrPublishCheckCollections: [ + /*"content", "product"*/ + ], }