mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-30 14:22:07 +03:00
fc9da07025
refs #9601 - you can now use `rss:false` - ability to define a custom rss url with a target template (+ content_type) - ability to disable rss for channel or collection
24 lines
707 B
JavaScript
24 lines
707 B
JavaScript
const debug = require('ghost-ignition').debug('services:routing:helpers:renderer'),
|
|
setContext = require('./context'),
|
|
templates = require('./templates');
|
|
|
|
module.exports = function renderer(req, res, data) {
|
|
// Context
|
|
setContext(req, res, data);
|
|
|
|
// Template
|
|
templates.setTemplate(req, res, data);
|
|
|
|
// Render Call
|
|
debug('Rendering template: ' + res._template + ' for: ' + req.originalUrl);
|
|
debug('res.locals', res.locals);
|
|
|
|
if (res.routerOptions && res.routerOptions.contentType) {
|
|
if (res.routerOptions.templates.indexOf(res._template) !== -1) {
|
|
res.type(res.routerOptions.contentType);
|
|
}
|
|
}
|
|
|
|
res.render(res._template, data);
|
|
};
|