Ghost/core/server/apps/amp/index.js
Hannah Wolfe abaf0461cf Highlighted routes, controllers & renderers
refs #5091, refs #9192

- There are several theme template "renderers" all over the codebase
- Some are in apps, and were called "controllers"
- One is in error handling
- All of them now have comments marking out how they share logic/steps
- Other comments describe routes & controllers where they live
2017-11-08 09:45:12 +00:00

23 lines
638 B
JavaScript

var router = require('./lib/router'),
registerHelpers = require('./lib/helpers'),
// Dirty requires
config = require('../../config'),
settingsCache = require('../../settings/cache');
module.exports = {
activate: function activate(ghost) {
var ampRoute = '*/' + config.get('routeKeywords').amp + '/';
ghost.routeService.registerRouter(ampRoute, function settingsEnabledRouter(req, res, next) {
if (settingsCache.get('amp') === true) {
return router.apply(this, arguments);
}
next();
});
registerHelpers(ghost);
}
};