From 0570fb7971bfa2ff2fc5cb9dc7d33666ee855255 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Goetz?= Date: Tue, 5 Jun 2018 23:02:01 +0200 Subject: [PATCH] Fix breadcrumb support of multiple folders with the same name. Fixes #54 --- libs/Format/HTML/ContentPage.php | 4 ++-- libs/Format/HTML/Template.php | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/libs/Format/HTML/ContentPage.php b/libs/Format/HTML/ContentPage.php index 6743f73..cb3bf3a 100644 --- a/libs/Format/HTML/ContentPage.php +++ b/libs/Format/HTML/ContentPage.php @@ -52,7 +52,7 @@ class ContentPage extends \Todaymade\Daux\Format\Base\ContentPage if (!empty($parents)) { foreach ($parents as $node) { $page = $node->getIndexPage() ?: $node->getFirstPage(); - $breadcrumb_trail[$node->getTitle()] = $page ? $page->getUrl() : ''; + $breadcrumb_trail[] = ['title' => $node->getTitle(), 'url' => $page ? $page->getUrl() : '']; } } @@ -98,7 +98,7 @@ class ContentPage extends \Todaymade\Daux\Format\Base\ContentPage $page['breadcrumb_separator'] = $params['html']['breadcrumb_separator']; if ($this->homepage) { - $page['breadcrumb_trail'] = [$this->file->getTitle() => '']; + $page['breadcrumb_trail'] = [['title' => $this->file->getTitle(), 'url' => '']]; } } diff --git a/libs/Format/HTML/Template.php b/libs/Format/HTML/Template.php index 691fbb8..fa0900b 100644 --- a/libs/Format/HTML/Template.php +++ b/libs/Format/HTML/Template.php @@ -99,8 +99,8 @@ class Template $title = ''; $breadcrumb_trail = $page['breadcrumb_trail']; $separator = $this->getSeparator($page['breadcrumb_separator']); - foreach ($breadcrumb_trail as $key => $value) { - $title .= '' . $key . '' . $separator; + foreach ($breadcrumb_trail as $value) { + $title .= '' . $value['title'] . '' . $separator; } if ($page['filename'] === 'index' || $page['filename'] === '_index') { if ($page['title'] != '') {