0
Fork 0
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:
Hannah Wolfe 2020-06-27 17:52:03 +01:00
parent 4ccfca8c00
commit cd3f8e9e2d

View file

@ -81,13 +81,6 @@ module.exports.start = (apiVersion) => {
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) => {
const collectionRouter = new CollectionRouter(key, value, RESOURCE_CONFIG);
siteRouter.mountRouter(collectionRouter.router());
@ -99,6 +92,13 @@ module.exports.start = (apiVersion) => {
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');
siteRouter.mountRouter(appRouter.router());