Skip to content
This repository has been archived by the owner on Dec 27, 2018. It is now read-only.

Commit

Permalink
Fixing Section generator in case of custom index.
Browse files Browse the repository at this point in the history
  • Loading branch information
ArnaudLigny committed Sep 1, 2016
1 parent 29ba54b commit dad5397
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/Generator/Section.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,13 @@ public function generate(PageCollection $pageCollection, \Closure $messageCallba
// adds node pages to collection
if (count($sections) > 0) {
$menuWeight = 100;
foreach ($sections as $node => $pages) {
if (!$pageCollection->has($node)) {
foreach ($sections as $section => $pages) {
if (!$pageCollection->has($section.'/index')) {
usort($pages, 'PHPoole\Page\Utils::sortByDate');
$page = (new Page())
->setId(Page::urlize(sprintf('%s/index', $node)))
->setPathname(Page::urlize(sprintf('%s', $node)))
->setTitle(ucfirst($node))
->setId(Page::urlize(sprintf('%s/index', $section)))
->setPathname(Page::urlize(sprintf('%s', $section)))
->setTitle(ucfirst($section))
->setNodeType(NodeType::SECTION)
->setVariable('pages', $pages)
->setVariable('menu', [
Expand Down
3 changes: 3 additions & 0 deletions tests/fixtures/website/content/NotASection/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
alias: section
---

0 comments on commit dad5397

Please sign in to comment.