mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-26 20:34:02 +03:00
075dd8ac9b
closes #1753 - Pages are registered to '/:slug/' route if posts are using dated permalinks
20 lines
715 B
JavaScript
20 lines
715 B
JavaScript
var frontend = require('../controllers/frontend'),
|
|
api = require('../api');
|
|
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);
|
|
|
|
api.settings.read('permalinks').then(function (permalinks) {
|
|
if (permalinks.value !== '/:slug/') {
|
|
server.get('/:slug/', frontend.page);
|
|
server.get(permalinks.value, frontend.post);
|
|
} else {
|
|
server.get(permalinks.value, frontend.single);
|
|
}
|
|
});
|
|
};
|