This commit is contained in:
@@ -6,13 +6,10 @@ module.exports = {
|
||||
// / is de home
|
||||
if (path == "/") return 1
|
||||
|
||||
// all other sites are in db
|
||||
path = path?.replace(/^\//, "")
|
||||
|
||||
// filter for path or alternativePaths
|
||||
const resp = context.db.find("content", {
|
||||
filter: {
|
||||
$or: [{ path }, { "alternativePaths.path": path }],
|
||||
$or: [{ path }],
|
||||
},
|
||||
selector: { _id: 1 },
|
||||
})
|
||||
|
||||
@@ -71,6 +71,7 @@ const { obj2str, log } = require("../lib/utils")
|
||||
html = "<!-- NO SSR RENDERING -->"
|
||||
} else if (pNotfound) {
|
||||
status = 404
|
||||
console.log("IS 404")
|
||||
html = "404 NOT FOUND"
|
||||
} else {
|
||||
// try rendering, if error output plain html
|
||||
@@ -137,6 +138,7 @@ const { obj2str, log } = require("../lib/utils")
|
||||
// @ts-ignore
|
||||
if (context.is404) {
|
||||
status = 404
|
||||
console.log("IS 404")
|
||||
} else {
|
||||
cacheIt = true
|
||||
}
|
||||
@@ -154,7 +156,7 @@ const { obj2str, log } = require("../lib/utils")
|
||||
tpl = tpl.replace("<!--HTML-->", html)
|
||||
tpl = tpl.replace("<!--SSR.ERROR-->", error ? "<!--" + error + "-->" : "")
|
||||
tpl = tpl.replace("<!--SSR.COMMENT-->", comment ? "<!--" + comment + "-->" : "")
|
||||
|
||||
console.log("CACHE", cacheIt, noCache)
|
||||
// save cache if adviced
|
||||
if (cacheIt && !noCache) {
|
||||
context.db.create("ssr", {
|
||||
|
||||
Reference in New Issue
Block a user