0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-01-20 22:42:53 -05:00

🐛 Fixed page vs post context calculation

closes https://github.com/TryGhost/Ghost/issues/14886
refs 0c097f6532

- The context calculation after referenced change was adding a stray "post" entry into the context, causing the `{{#is "post"}}` helper to fail.
This commit is contained in:
Naz 2022-05-24 14:51:40 +08:00 committed by naz
parent 14828399e0
commit 4fa412c880

View file

@ -60,7 +60,7 @@ function setResponseContext(req, res, data) {
// @TODO: remove first if condition when only page key is returned // @TODO: remove first if condition when only page key is returned
// ref.: https://github.com/TryGhost/Ghost/issues/10042 // ref.: https://github.com/TryGhost/Ghost/issues/10042
// The first if is now used by the preview route // The first if is now used by the preview route
if (data && data.post && data.post.page) { if (data && data.page) {
if (!res.locals.context.includes('page')) { if (!res.locals.context.includes('page')) {
res.locals.context.push('page'); res.locals.context.push('page');
} }
@ -68,10 +68,6 @@ function setResponseContext(req, res, data) {
if (!res.locals.context.includes('post')) { if (!res.locals.context.includes('post')) {
res.locals.context.push('post'); res.locals.context.push('post');
} }
} else if (data && data.page) {
if (!res.locals.context.includes('page')) {
res.locals.context.push('page');
}
} else if (data && data.tag) { } else if (data && data.tag) {
if (!res.locals.context.includes('tag')) { if (!res.locals.context.includes('tag')) {
res.locals.context.push('tag'); res.locals.context.push('tag');