Fix the URL Generator for inherit_index, fixes #381
Cette révision appartient à :
Parent
c450903b3a
révision
647c0beb3b
@ -266,11 +266,11 @@ If your server does not have a default timezone set in php.ini, it may return er
|
||||
```
|
||||
|
||||
###Inherit Index
|
||||
This feature will insruct the router to seek the first available file to use when a request to a folder is made and the index is not found.
|
||||
This feature will instructs the navigation generator to seek the first available file to use when there is no index in a folder.
|
||||
|
||||
```json
|
||||
{
|
||||
"live": {
|
||||
"html": {
|
||||
"inherit_index": true
|
||||
}
|
||||
}
|
||||
|
@ -8,7 +8,6 @@
|
||||
"folders": ["99_Not_Ready"]
|
||||
},
|
||||
"live": {
|
||||
"inherit_index": true,
|
||||
"clean_urls": true
|
||||
},
|
||||
"html": {
|
||||
@ -18,6 +17,7 @@
|
||||
"toggle_code": true,
|
||||
"date_modified": true,
|
||||
"float": true,
|
||||
"inherit_index": true,
|
||||
|
||||
"repo": "justinwalsh/daux.io",
|
||||
"twitter": ["justin_walsh", "todaymade"],
|
||||
|
@ -19,7 +19,6 @@
|
||||
"timezone": "America/Los_Angeles",
|
||||
|
||||
"live": {
|
||||
"inherit_index": false,
|
||||
"clean_urls": false
|
||||
},
|
||||
|
||||
@ -32,6 +31,7 @@
|
||||
"auto_landing": true,
|
||||
"search": true,
|
||||
"auto_toc": false,
|
||||
"inherit_index": false,
|
||||
|
||||
"repo": "",
|
||||
"twitter": [],
|
||||
|
@ -87,4 +87,17 @@ class Config extends ArrayObject
|
||||
{
|
||||
return array_key_exists('languages', $this) && !empty($this['languages']);
|
||||
}
|
||||
|
||||
public function shouldInheritIndex()
|
||||
{
|
||||
if (array_key_exists('html', $this) && array_key_exists('inherit_index', $this['html'])) {
|
||||
return $this['html']['inherit_index'];
|
||||
}
|
||||
|
||||
if (array_key_exists('live', $this) && array_key_exists('inherit_index', $this['live'])) {
|
||||
return $this['live']['inherit_index'];
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -133,12 +133,8 @@ class Template
|
||||
'class' => strpos($current_url, $link) === 0 ? 'Nav__item--open' : '',
|
||||
];
|
||||
|
||||
if ($mode === Daux::STATIC_MODE) {
|
||||
$link .= '/index.html';
|
||||
}
|
||||
|
||||
if ($node->getIndexPage()) {
|
||||
$folder['href'] = $base_page . $link;
|
||||
if ($index = $node->getIndexPage()) {
|
||||
$folder['href'] = $base_page . $index->getUrl();
|
||||
}
|
||||
|
||||
//Child pages
|
||||
|
@ -120,13 +120,7 @@ class Directory extends Entry implements \ArrayAccess, \IteratorAggregate
|
||||
return $this->children[$index_key];
|
||||
}
|
||||
|
||||
/*
|
||||
If the inherit_index flag is set, then we seek child content
|
||||
*/
|
||||
if ($this->getConfig()['mode'] == Daux::LIVE_MODE
|
||||
&& !empty($this->getConfig()['live']['inherit_index'])
|
||||
&& $first_page = $this->seekFirstPage()
|
||||
) {
|
||||
if ($this->getConfig()->shouldInheritIndex() && $first_page = $this->seekFirstPage()) {
|
||||
return $first_page;
|
||||
}
|
||||
|
||||
|
Chargement…
Référencer dans un nouveau ticket
Block a user