diff --git a/libs/Config.php b/libs/Config.php index 6e2b53d..282176d 100644 --- a/libs/Config.php +++ b/libs/Config.php @@ -5,6 +5,11 @@ use Todaymade\Daux\Format\HTML\Config as HTMLConfig; class Config extends BaseConfig { + public function getTitle() + { + return $this['title']; + } + public function getCurrentPage() { return $this['current_page']; diff --git a/libs/Format/HTML/ContentPage.php b/libs/Format/HTML/ContentPage.php index e07aac7..ab4a3b8 100644 --- a/libs/Format/HTML/ContentPage.php +++ b/libs/Format/HTML/ContentPage.php @@ -9,11 +9,6 @@ class ContentPage extends \Todaymade\Daux\Format\Base\ContentPage private function isHomepage() { - // If we don't have the auto_landing parameter, we don't want any homepage - if (array_key_exists('auto_landing', $this->params['html']) && !$this->params['html']['auto_landing']) { - return false; - } - // If the current page isn't the index, no chance it is the landing page if ($this->file->getParent()->getIndexPage() != $this->file) { return false; @@ -23,6 +18,15 @@ class ContentPage extends \Todaymade\Daux\Format\Base\ContentPage return $this->file->getParent() instanceof Root; } + private function isLanding() { + // If we don't have the auto_landing parameter, we don't want any homepage + if (array_key_exists('auto_landing', $this->params['html']) && !$this->params['html']['auto_landing']) { + return false; + } + + return $this->homepage; + } + private function initialize() { $this->homepage = $this->isHomepage(); @@ -91,12 +95,16 @@ class ContentPage extends \Todaymade\Daux\Format\Base\ContentPage if ($page['breadcrumbs']) { $page['breadcrumb_trail'] = $this->getBreadcrumbTrail($this->file->getParents(), $params->isMultilanguage()); $page['breadcrumb_separator'] = $params['html']['breadcrumb_separator']; + + if ($this->homepage) { + $page['breadcrumb_trail'] = [$this->file->getTitle() => '']; + } } $context = ['page' => $page, 'params' => $params]; $template = new Template($params['templates'], $params['theme']['templates']); - return $template->render($this->homepage ? 'theme::home' : 'theme::content', $context); + return $template->render($this->isLanding() ? 'theme::home' : 'theme::content', $context); } } diff --git a/libs/Tree/Builder.php b/libs/Tree/Builder.php index f3692b9..6f986b4 100644 --- a/libs/Tree/Builder.php +++ b/libs/Tree/Builder.php @@ -117,7 +117,7 @@ class Builder if ($entry->getUri() == $config['index_key']) { if ($parent instanceof Root) { - $entry->setTitle($config['title']); + $entry->setTitle($config->getTitle()); } else { $entry->setTitle($parent->getTitle()); }