Small fixes in url generations

This commit is contained in:
Stéphane Goetz 2015-07-21 09:51:55 +02:00
parent 16f15ae2b2
commit 12739c2044
3 changed files with 9 additions and 6 deletions

View File

@ -40,7 +40,8 @@ class MarkdownPage extends \Todaymade\Daux\Format\Base\MarkdownPage
$breadcrumb_trail = array();
if (!empty($parents)) {
foreach ($parents as $node) {
$breadcrumb_trail[$node->getTitle()] = $node->getUrl();
$page = $node->getIndexPage() ?: $node->getFirstPage();
$breadcrumb_trail[$node->getTitle()] = $page? $page->getUrl() : '';
}
}
return $breadcrumb_trail;

View File

@ -2,7 +2,7 @@
use League\CommonMark\Environment;
use Symfony\Component\Console\Output\OutputInterface;
use Todaymade\Daux\Tree\Directory;
use Todaymade\Daux\Tree\Root;
class Processor
{
@ -38,9 +38,9 @@ class Processor
* the tree as you want, move pages, modify
* pages and even add new ones.
*
* @param Directory $root
* @param Root $root
*/
public function manipulateTree(Directory $root)
public function manipulateTree(Root $root)
{
}

View File

@ -145,8 +145,10 @@ class Builder
*/
public static function getOrCreatePage(Directory $parent, $title)
{
$slug = DauxHelper::slug($title);
$uri = $slug = DauxHelper::slug($title);
if ($parent->getConfig()['mode'] === Daux::STATIC_MODE) {
$uri = $slug . ".html";
}
if (array_key_exists($uri, $parent->getEntries())) {
return $parent->getEntries()[$uri];