mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-14 09:52:09 +03:00
13c1742eb9
refs #5091 - Move renderChannel to own file - Update channel config to have get/list methods - Move main routes to be generated based on the list of channels - Move RSS routes to be subroutes of channels - Move redirect301 to be a shared util - Add full test coverage - Split frontend route tests into frontend & channels
56 lines
1.4 KiB
JavaScript
56 lines
1.4 KiB
JavaScript
var _ = require('lodash'),
|
|
config = require('../../config'),
|
|
channelConfig;
|
|
|
|
channelConfig = function channelConfig() {
|
|
var defaults = {
|
|
index: {
|
|
name: 'index',
|
|
route: '/',
|
|
frontPageTemplate: 'home'
|
|
},
|
|
tag: {
|
|
name: 'tag',
|
|
route: '/' + config.routeKeywords.tag + '/:slug/',
|
|
postOptions: {
|
|
filter: 'tags:\'%s\''
|
|
},
|
|
data: {
|
|
tag: {
|
|
type: 'read',
|
|
resource: 'tags',
|
|
options: {slug: '%s'}
|
|
}
|
|
},
|
|
slugTemplate: true,
|
|
editRedirect: '/ghost/settings/tags/:slug/'
|
|
},
|
|
author: {
|
|
name: 'author',
|
|
route: '/' + config.routeKeywords.author + '/:slug/',
|
|
postOptions: {
|
|
filter: 'author:\'%s\''
|
|
},
|
|
data: {
|
|
author: {
|
|
type: 'read',
|
|
resource: 'users',
|
|
options: {slug: '%s'}
|
|
}
|
|
},
|
|
slugTemplate: true,
|
|
editRedirect: '/ghost/team/:slug/'
|
|
}
|
|
};
|
|
|
|
return defaults;
|
|
};
|
|
|
|
module.exports.list = function list() {
|
|
return channelConfig();
|
|
};
|
|
|
|
module.exports.get = function get(name) {
|
|
return _.cloneDeep(channelConfig()[name]);
|
|
};
|