mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-02-03 23:00:14 -05:00
0c097f6532
refs https://github.com/TryGhost/Toolbox/issues/332 - After removing the concept of a boolean "page: true" from the page/post resources frontend resource rendering didn't have enough information to pick the correct template - Resolved this issue through passing of additional "context" to the template picker. Something nicer should be worked on in the future, as context pattern feels dirty here.
18 lines
618 B
JavaScript
18 lines
618 B
JavaScript
const debug = require('@tryghost/debug')('services:routing:renderer:render-post');
|
|
const formatResponse = require('./format-response');
|
|
const renderer = require('./renderer');
|
|
/**
|
|
* @description Helper to handle rendering multiple resources.
|
|
*
|
|
* @param {Object} req
|
|
* @param {Object} res
|
|
* @returns {Closure)
|
|
*/
|
|
module.exports = function renderEntry(req, res) {
|
|
debug('renderEntry called');
|
|
return function renderEntryClosure(entry) {
|
|
// Format data 2 - 1 is in preview/entry
|
|
// Render
|
|
return renderer(req, res, formatResponse.entry(entry, res.routerOptions?.context));
|
|
};
|
|
};
|