diff --git a/examples/multilanguage/_index.md b/examples/multilanguage/_index.md new file mode 100644 index 0000000..bb38d90 --- /dev/null +++ b/examples/multilanguage/_index.md @@ -0,0 +1,3 @@ +This is our landing page. + +Welcome to this awesome multilanguage documentation. diff --git a/examples/multilanguage/config.json b/examples/multilanguage/config.json new file mode 100644 index 0000000..43c5c53 --- /dev/null +++ b/examples/multilanguage/config.json @@ -0,0 +1,9 @@ +{ + "title": "Multilanguage Example", + "tagline": "The Easiest Way To Document Your Project", + + "languages": { + "en": "English", + "fr": "Français" + } +} diff --git a/examples/multilanguage/en/00_Getting_Started.md b/examples/multilanguage/en/00_Getting_Started.md new file mode 100644 index 0000000..834f612 --- /dev/null +++ b/examples/multilanguage/en/00_Getting_Started.md @@ -0,0 +1 @@ +It starts here. diff --git a/examples/multilanguage/en/Configuration/Options.md b/examples/multilanguage/en/Configuration/Options.md new file mode 100644 index 0000000..1c8c6b4 --- /dev/null +++ b/examples/multilanguage/en/Configuration/Options.md @@ -0,0 +1 @@ +Some configuration options diff --git a/examples/multilanguage/fr/00_Commencer.md b/examples/multilanguage/fr/00_Commencer.md new file mode 100644 index 0000000..ca047ef --- /dev/null +++ b/examples/multilanguage/fr/00_Commencer.md @@ -0,0 +1 @@ +C'est ici que tout commence. diff --git a/examples/multilanguage/fr/Configuration/Options.md b/examples/multilanguage/fr/Configuration/Options.md new file mode 100644 index 0000000..88709d0 --- /dev/null +++ b/examples/multilanguage/fr/Configuration/Options.md @@ -0,0 +1 @@ +Quelques options de configuration diff --git a/libs/Daux.php b/libs/Daux.php index 65e74eb..9a56106 100644 --- a/libs/Daux.php +++ b/libs/Daux.php @@ -229,7 +229,8 @@ class Daux $this->tree = new Root($this->getParams()); Builder::build($this->tree, $this->options['ignore']); - if (!empty($this->options['languages'])) { + // Apply the language name as Section title + if ($this->options->isMultilanguage()) { foreach ($this->options['languages'] as $key => $node) { $this->tree->getEntries()[$key]->setTitle($node); } diff --git a/libs/Format/HTML/ContentPage.php b/libs/Format/HTML/ContentPage.php index 04bc650..e07aac7 100644 --- a/libs/Format/HTML/ContentPage.php +++ b/libs/Format/HTML/ContentPage.php @@ -9,18 +9,17 @@ class ContentPage extends \Todaymade\Daux\Format\Base\ContentPage private function isHomepage() { + // If we don't have the auto_landing parameter, we don't want any homepage if (array_key_exists('auto_landing', $this->params['html']) && !$this->params['html']['auto_landing']) { return false; } + // If the current page isn't the index, no chance it is the landing page if ($this->file->getParent()->getIndexPage() != $this->file) { return false; } - if ($this->params->isMultilanguage()) { - return $this->file->getParent()->getParent() instanceof Root; - } - + // If the direct parent is root, this is the homage return $this->file->getParent() instanceof Root; } diff --git a/templates/layout/05_page.php b/templates/layout/05_page.php index 600ef68..ac680d1 100755 --- a/templates/layout/05_page.php +++ b/templates/layout/05_page.php @@ -20,7 +20,7 @@ $path = ''; if ($page['language'] !== '') { - $rendertree = $tree->value[$page['language']]; + $rendertree = $tree[$page['language']]; $path = $page['language']; }