forked from cms/tibi-svelte-starter
🔧 fix: comment out unused SSR path validation logic and update collection check
This commit is contained in:
@@ -35,39 +35,41 @@ module.exports = {
|
|||||||
// validate if path ssr rendering is ok, -1 = NOTFOUND, 0 = NO SSR, 1 = SSR
|
// 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
|
// pe. use context.readCollection("product", {filter: {path: path}}) ... to validate dynamic urls
|
||||||
|
|
||||||
// / is fixed url
|
// // / is fixed url
|
||||||
if (path == "/cart") return 1
|
// if (path == "/cart") return 1
|
||||||
|
|
||||||
// path starts with /products/ is product
|
// // path starts with /products/ is product
|
||||||
if (path?.startsWith("/products/")) {
|
// if (path?.startsWith("/products/")) {
|
||||||
const slug = path?.replace(/^\/products\//, "")
|
// const slug = path?.replace(/^\/products\//, "")
|
||||||
const resp = context.db.find("product", {
|
// const resp = context.db.find("product", {
|
||||||
filter: {
|
// filter: {
|
||||||
$and: [{ slug: slug }, publishedFilter],
|
// $and: [{ slug: slug }, publishedFilter],
|
||||||
},
|
// },
|
||||||
|
|
||||||
selector: { _id: 1 },
|
// selector: { _id: 1 },
|
||||||
})
|
// })
|
||||||
if (resp && resp.length) {
|
// if (resp && resp.length) {
|
||||||
return 1
|
// return 1
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
// // all other sites are in db
|
// // // all other sites are in db
|
||||||
//path = path?.replace(/^\//, "")
|
// //path = path?.replace(/^\//, "")
|
||||||
const resp = context.db.find("content", {
|
// const resp = context.db.find("content", {
|
||||||
filter: {
|
// filter: {
|
||||||
$and: [{ $or: [{ path }, { "alternativePaths.path": path }] }, publishedFilter],
|
// $and: [{ $or: [{ path }, { "alternativePaths.path": path }] }, publishedFilter],
|
||||||
},
|
// },
|
||||||
|
|
||||||
selector: { _id: 1 },
|
// selector: { _id: 1 },
|
||||||
})
|
// })
|
||||||
if (resp && resp.length) {
|
// if (resp && resp.length) {
|
||||||
return 1
|
// return 1
|
||||||
}
|
// }
|
||||||
|
|
||||||
// not found
|
// not found
|
||||||
return -1
|
return -1
|
||||||
},
|
},
|
||||||
ssrPublishCheckCollections: ["content", "product"],
|
ssrPublishCheckCollections: [
|
||||||
|
/*"content", "product"*/
|
||||||
|
],
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user