diff --git a/system/src/Grav/Common/Page/Pages.php b/system/src/Grav/Common/Page/Pages.php index 87744b6c9..8f31afb09 100644 --- a/system/src/Grav/Common/Page/Pages.php +++ b/system/src/Grav/Common/Page/Pages.php @@ -95,6 +95,8 @@ class Pages protected $initialized = false; + protected $active_lang; + /** * @var Types */ @@ -143,7 +145,7 @@ class Pages */ public function baseRoute($lang = null) { - $key = $lang ?: 'default'; + $key = $lang ?: $this->active_lang ?: 'default'; if (!isset($this->baseRoute[$key])) { /** @var Language $language */ @@ -968,6 +970,9 @@ class Pages $pages_dir = $locator->findResource('page://'); + // Set active language + $this->active_lang = $language->getActive(); + if ($config->get('system.cache.enabled')) { /** @var Cache $cache */ $cache = $this->grav['cache'];