mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-03-11 02:12:21 -05:00
Reordered routes to load taxonomies last
closes #11936 - the driving reason for doing this is so that when posts and taxonomies all have the same route, e.g. /:slug/ the /edit route won't default to looking up tags this is the issue outlined in #11936 - the side effect of this is that in this case, all routes will default to looking up posts before tags, so if you have a /test/ post and a /test/ tag, prior to this change, the tag would have been loaded first but posts are more important than tags, and should have higher priority, so this change is considered correct
This commit is contained in:
parent
4ccfca8c00
commit
cd3f8e9e2d
1 changed files with 7 additions and 7 deletions
14
core/frontend/services/routing/bootstrap.js
vendored
14
core/frontend/services/routing/bootstrap.js
vendored
|
@ -81,13 +81,6 @@ module.exports.start = (apiVersion) => {
|
||||||
registry.setRouter(staticRoutesRouter.identifier, staticRoutesRouter);
|
registry.setRouter(staticRoutesRouter.identifier, staticRoutesRouter);
|
||||||
});
|
});
|
||||||
|
|
||||||
_.each(dynamicRoutes.taxonomies, (value, key) => {
|
|
||||||
const taxonomyRouter = new TaxonomyRouter(key, value, RESOURCE_CONFIG);
|
|
||||||
siteRouter.mountRouter(taxonomyRouter.router());
|
|
||||||
|
|
||||||
registry.setRouter(taxonomyRouter.identifier, taxonomyRouter);
|
|
||||||
});
|
|
||||||
|
|
||||||
_.each(dynamicRoutes.collections, (value, key) => {
|
_.each(dynamicRoutes.collections, (value, key) => {
|
||||||
const collectionRouter = new CollectionRouter(key, value, RESOURCE_CONFIG);
|
const collectionRouter = new CollectionRouter(key, value, RESOURCE_CONFIG);
|
||||||
siteRouter.mountRouter(collectionRouter.router());
|
siteRouter.mountRouter(collectionRouter.router());
|
||||||
|
@ -99,6 +92,13 @@ module.exports.start = (apiVersion) => {
|
||||||
|
|
||||||
registry.setRouter('staticPagesRouter', staticPagesRouter);
|
registry.setRouter('staticPagesRouter', staticPagesRouter);
|
||||||
|
|
||||||
|
_.each(dynamicRoutes.taxonomies, (value, key) => {
|
||||||
|
const taxonomyRouter = new TaxonomyRouter(key, value, RESOURCE_CONFIG);
|
||||||
|
siteRouter.mountRouter(taxonomyRouter.router());
|
||||||
|
|
||||||
|
registry.setRouter(taxonomyRouter.identifier, taxonomyRouter);
|
||||||
|
});
|
||||||
|
|
||||||
const appRouter = new ParentRouter('AppsRouter');
|
const appRouter = new ParentRouter('AppsRouter');
|
||||||
siteRouter.mountRouter(appRouter.router());
|
siteRouter.mountRouter(appRouter.router());
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue