Skip to content

Commit

Permalink
Fix breadcrumb support of multiple folders with the same name. Fixes #54
Browse files Browse the repository at this point in the history
  • Loading branch information
onigoetz committed Jun 5, 2018
1 parent 049e5cd commit 0570fb7
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions libs/Format/HTML/ContentPage.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ private function getBreadcrumbTrail($parents, $multilanguage)
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() : ''];
}
}

Expand Down Expand Up @@ -98,7 +98,7 @@ protected function generatePage()
$page['breadcrumb_separator'] = $params['html']['breadcrumb_separator'];

if ($this->homepage) {
$page['breadcrumb_trail'] = [$this->file->getTitle() => ''];
$page['breadcrumb_trail'] = [['title' => $this->file->getTitle(), 'url' => '']];
}
}

Expand Down
4 changes: 2 additions & 2 deletions libs/Format/HTML/Template.php
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,8 @@ protected function registerFunctions($engine)
$title = '';
$breadcrumb_trail = $page['breadcrumb_trail'];
$separator = $this->getSeparator($page['breadcrumb_separator']);
foreach ($breadcrumb_trail as $key => $value) {
$title .= '<a href="' . $base_page . $value . '">' . $key . '</a>' . $separator;
foreach ($breadcrumb_trail as $value) {
$title .= '<a href="' . $base_page . $value['url'] . '">' . $value['title'] . '</a>' . $separator;
}
if ($page['filename'] === 'index' || $page['filename'] === '_index') {
if ($page['title'] != '') {
Expand Down

0 comments on commit 0570fb7

Please sign in to comment.