From 1a91cf7033f16392963347712904dd780bb65edd Mon Sep 17 00:00:00 2001 From: Andy Miller Date: Tue, 30 Jun 2015 14:59:48 -0600 Subject: [PATCH] add canonical routes like an alias --- system/src/Grav/Common/Page/Pages.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/system/src/Grav/Common/Page/Pages.php b/system/src/Grav/Common/Page/Pages.php index 7de8bda10..3f81dda5f 100644 --- a/system/src/Grav/Common/Page/Pages.php +++ b/system/src/Grav/Common/Page/Pages.php @@ -631,7 +631,14 @@ class Pages $taxonomy->addTaxonomy($page); // add route - $this->routes[$page->route()] = $page->path(); + $route = $page->route(); + $this->routes[$route] = $page->path(); + + // add canonical + $route_canonical = $page->routeCanonical(); + if ($route_canonical && ($route !== $route_canonical)) { + $this->routes[$route_canonical] = $page->path(); + } // add aliases to routes list if they are provided $route_aliases = $page->routeAliases();