Add a way to disable the automatic landing page

fixes #338
This commit is contained in:
Stéphane Goetz 2016-01-07 21:18:18 +01:00
parent 5997820360
commit a3ebedb7e3
4 changed files with 31 additions and 12 deletions

BIN
daux.phar Executable file → Normal file

Binary file not shown.

View File

@ -8,4 +8,14 @@ If you want to create a beautiful landing page for your project, create a `_inde
}
```
> The image can be a local or remote image. By default, the path is relative to the root of the documentation
> The image can be a local or remote image. By default, the path is relative to the root of the documentation.
To disable the automatic landing page, you can set `auto_landing` to false in the `html` section of your configuration
```json
{
"html": {
"auto_landing": false
}
}
```

View File

@ -29,6 +29,7 @@
"toggle_code": false,
"date_modified": false,
"float": false,
"auto_landing": true,
"repo": "",
"twitter": [],

View File

@ -7,18 +7,26 @@ class ContentPage extends \Todaymade\Daux\Format\Base\ContentPage
private $language;
private $homepage;
private function isHomepage()
{
if (array_key_exists('auto_landing', $this->params['html']) && !$this->params['html']['auto_landing']) {
return false;
}
if ($this->file->getParent()->getIndexPage() != $this->file) {
return false;
}
if ($this->params['multilanguage']) {
return ($this->file->getParent()->getParent() instanceof Root);
}
return ($this->file->getParent() instanceof Root);
}
private function initialize()
{
$this->homepage = false;
if ($this->file->getParent()->getIndexPage() == $this->file) {
if ($this->params['multilanguage']) {
if ($this->file->getParent()->getParent() instanceof Root) {
$this->homepage = true;
}
} elseif ($this->file->getParent() instanceof Root) {
$this->homepage = true;
}
}
$this->homepage = $this->isHomepage();
$this->language = '';
if ($this->params['multilanguage'] && count($this->file->getParents())) {
@ -41,7 +49,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[$node->getTitle()] = $page ? $page->getUrl() : '';
}
}
return $breadcrumb_trail;