From 2c247a45297fd93b94f7c4922aa9e746fc42989f Mon Sep 17 00:00:00 2001 From: Andy Miller Date: Sun, 9 Nov 2014 12:52:23 -0700 Subject: [PATCH] Handle sub pages of 'home' menu item better --- system/src/Grav/Common/Page/Page.php | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/system/src/Grav/Common/Page/Page.php b/system/src/Grav/Common/Page/Page.php index e75638bba..6a49b0a56 100644 --- a/system/src/Grav/Common/Page/Page.php +++ b/system/src/Grav/Common/Page/Page.php @@ -1349,10 +1349,21 @@ class Page { /** @var Uri $uri */ $uri = self::$grav['uri']; + $config = self::$grav['config']; - if (!$this->home() && (strpos($uri->url(), $this->url()) === 0)) { - return true; + // Special check when item is home + if ($this->home()) { + $paths = $uri->paths(); + $home = ltrim($config->get('system.home.alias'), '/'); + if ($paths[0] == $home) { + return true; + } + } else { + if (strpos($uri->url(), $this->url()) === 0) { + return true; + } } + return false; }