2013-11-21 22:44:18 +04:00
|
|
|
var frontend = require('../controllers/frontend'),
|
2013-12-06 12:51:35 +04:00
|
|
|
api = require('../api');
|
2013-11-12 09:27:12 +04:00
|
|
|
module.exports = function (server) {
|
|
|
|
// ### Frontend routes
|
|
|
|
/* TODO: dynamic routing, homepage generator, filters ETC ETC */
|
|
|
|
server.get('/rss/', frontend.rss);
|
|
|
|
server.get('/rss/:page/', frontend.rss);
|
|
|
|
server.get('/page/:page/', frontend.homepage);
|
|
|
|
server.get('/', frontend.homepage);
|
2013-12-06 12:51:35 +04:00
|
|
|
|
|
|
|
api.settings.read('permalinks').then(function (permalinks) {
|
2013-12-28 03:21:43 +04:00
|
|
|
if (permalinks.value !== '/:slug/') {
|
|
|
|
server.get('/:slug/', frontend.page);
|
|
|
|
server.get(permalinks.value, frontend.post);
|
|
|
|
} else {
|
|
|
|
server.get(permalinks.value, frontend.single);
|
|
|
|
}
|
2013-12-06 12:51:35 +04:00
|
|
|
});
|
2013-11-21 22:44:18 +04:00
|
|
|
};
|