wm-AllKids-tibi2023/api/hooks/config.js
robin d3b36a6716
All checks were successful
deploy to production / deploy (push) Successful in 1m7s
SSR
2023-12-06 20:11:49 +00:00

25 lines
688 B
JavaScript

module.exports = {
ssrValidatePath: function (path) {
// 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 de home
if (path == "/") return 1
// filter for path or alternativePaths
const resp = context.db.find("content", {
filter: {
$or: [{ path }],
},
selector: { _id: 1 },
})
if (resp && resp.length) {
return 1
}
// not found
return -1
},
ssrAllowedAPIEndpoints: ["content", "medialib"],
}