mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-02-10 23:36:14 -05:00
no issue - This started as an attempt to simplify the admin redirect code - I realised we were sometimes using utils.redirect301 and sometimes not - Decided to move this into utils.url as it's more relevant to URL generation - Unified usage of redirects in the codebase - Updated tests & ensured we have basic coverage - rename adminRedirect -> redirectToAdmin - Tweak method signature, fix channel edit redirects - Tests: Optimised test descriptions for url-redirects_spec.js - ensure caching works as expected
56 lines
1.5 KiB
JavaScript
56 lines
1.5 KiB
JavaScript
var _ = require('lodash'),
|
|
config = require('../../config'),
|
|
utils = require('../../utils'),
|
|
channelConfig;
|
|
|
|
channelConfig = function channelConfig() {
|
|
var defaults = {
|
|
index: {
|
|
name: 'index',
|
|
route: '/',
|
|
frontPageTemplate: 'home'
|
|
},
|
|
tag: {
|
|
name: 'tag',
|
|
route: utils.url.urlJoin('/', config.get('routeKeywords').tag, ':slug/'),
|
|
postOptions: {
|
|
filter: 'tags:\'%s\'+tags.visibility:\'public\''
|
|
},
|
|
data: {
|
|
tag: {
|
|
type: 'read',
|
|
resource: 'tags',
|
|
options: {slug: '%s', visibility: 'public'}
|
|
}
|
|
},
|
|
slugTemplate: true,
|
|
editRedirect: '#/settings/tags/:slug/'
|
|
},
|
|
author: {
|
|
name: 'author',
|
|
route: utils.url.urlJoin('/', config.get('routeKeywords').author, ':slug/'),
|
|
postOptions: {
|
|
filter: 'author:\'%s\''
|
|
},
|
|
data: {
|
|
author: {
|
|
type: 'read',
|
|
resource: 'users',
|
|
options: {slug: '%s'}
|
|
}
|
|
},
|
|
slugTemplate: true,
|
|
editRedirect: '#/team/:slug/'
|
|
}
|
|
};
|
|
|
|
return defaults;
|
|
};
|
|
|
|
module.exports.list = function list() {
|
|
return channelConfig();
|
|
};
|
|
|
|
module.exports.get = function get(name) {
|
|
return _.cloneDeep(channelConfig()[name]);
|
|
};
|