fs.access(custom_template, function(err) {
if (err) custom_template = template;
res.render(custom_template, render, function(err, html) { // 663 строка
if (options.debug) {
options.debug.detail.push({
type: 'render',
mem:
Math.round(
(process.memoryUsage().heapUsed / 1024 / 1024) * 100
) / 100,
duration: new Date() - options.debug.duration.current + 'ms'
});
options.debug.duration.current = new Date();
}
if (err) console.log('[renderData] Render Error:', err);
var link_header = '';
if (options.userinfo.alt && render.page && render.page.pathname) {
link_header +=
(link_header ? ', ' : '') +
'<' +
options.userinfo.alt +
render.page.pathname.replace(/\/$/, '') +
'>; rel="alternate"; hreflang="x-default"';
}
if (options.userinfo.ru && render.page && render.page.pathname) {
link_header +=
(link_header ? ', ' : '') +
'<' +
options.userinfo.ru +
render.page.pathname.replace(/\/$/, '') +
'>; rel="alternate"; hreflang="ru"';
}
if (link_header) {
res.header('Link', link_header);
}
res
.status(
render.page && render.page.status_code
? render.page.status_code
: 200
)
.send(html);
if (
config.cache.time &&
render &&
!render.cache &&
!req.userinfo.bot.all
) {
render.cache = true;
CP_cache.set(urlHash, render, function(err) {});
}
if (options.debug) {
options.debug.duration =
new Date() - options.debug.duration.all + 'ms';
console.log(options.debug);
}
});
});