diff --git a/docs/customization.md b/docs/customization.md index fb5a3d7a35e..8529e7fb290 100644 --- a/docs/customization.md +++ b/docs/customization.md @@ -83,7 +83,7 @@ One of my (the author's) favourite features with Hyde is its automatic navigatio #### How it works: The sidebar works by creating a list of all the documentation pages. -The navigation menu is a bit more sophisticated, it adds all the top-level Blade and Markdown pages. It also adds an automatic link to the docs if there is an `index.md` or `readme.md` in the `_docs` directory. +The navigation menu is a bit more sophisticated, it adds all the top-level Blade and Markdown pages. It also adds an automatic link to the docs if there is an `index.md` in the `_docs` directory. #### Reordering Items Sadly, Hyde is not intelligent enough to determine what order items should be in (blame Dr Jekyll for this), so you will probably want to set a custom order. diff --git a/docs/documentation-pages.md b/docs/documentation-pages.md index f7a6bf419c5..612b2935c96 100644 --- a/docs/documentation-pages.md +++ b/docs/documentation-pages.md @@ -17,9 +17,9 @@ What is "the rest", you may ask? Well, for starters: - Hyde compiles your Markdown content into a beautiful static HTML page based on [the Lagrafo frontend](https://github.com/caendesilva/lagrafo) - A sidebar (which is responsive) is automatically created based on your Markdown files - - If you have an `index.md` or `readme.md` in the `_docs/` directory, it will be used as the sidebar header + - If you have an `index.md` in the `_docs/` directory, it will be used as the sidebar header - You can even [customize the order and labels](#sidebar-page-order) of sidebar items -- If you have an `index.md` or `readme.md` in the `_docs/` directory, +- If you have an `index.md` in the `_docs/` directory, a link to it will be added to the site navigation menu named "Docs". - If you have a Torchlight API token in your .env file, Hyde will even automatically enable Syntax Highlighting for you. See more about this in the [extensions page](extensions.html#torchlight). @@ -171,7 +171,7 @@ for example to specify a version like the Hyde docs does, you can specify the ou ### Automatic navigation menu -By default, a link to the documentation page is added to the navigation menu when an index.md or readme.md file is found in the `_docs` directory. +By default, a link to the documentation page is added to the navigation menu when an index.md file is found in the `_docs` directory. In version v0.38.0-beta and lower, this link had the internal priority of 500 putting it to the left of the automatic menu. In v0.39.0-beta and higher, the priority is set to 1000 to be placed at the end of the menu. See the reasoning behind this in [this GitHub issue](https://github.com/hydephp/develop/issues/24). You can customize the priority using the following config value in the `config/docs.php` file: diff --git a/packages/framework/resources/views/components/navigation/navigation-link.blade.php b/packages/framework/resources/views/components/navigation/navigation-link.blade.php index dc58cd710b9..133a396679b 100644 --- a/packages/framework/resources/views/components/navigation/navigation-link.blade.php +++ b/packages/framework/resources/views/components/navigation/navigation-link.blade.php @@ -1,6 +1,11 @@ -getRoute()->getRouteKey() === $item->route->getRouteKey(); +@endphp + + $item['current'] + , 'border-l-4 border-indigo-500 md:border-none font-medium -ml-6 pl-5 md:ml-0 md:pl-0 bg-gray-100 dark:bg-gray-800 md:bg-transparent dark:md:bg-transparent'=> $isCurrent ])> - {{ $item['title'] }} + {{ $item->title }} \ No newline at end of file diff --git a/packages/framework/resources/views/components/navigation/navigation-toggle-button.blade.php b/packages/framework/resources/views/components/navigation/navigation-toggle-button.blade.php deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/packages/framework/resources/views/layouts/navigation.blade.php b/packages/framework/resources/views/layouts/navigation.blade.php index 9df79fdebc3..4d33f6ca874 100644 --- a/packages/framework/resources/views/layouts/navigation.blade.php +++ b/packages/framework/resources/views/layouts/navigation.blade.php @@ -1,6 +1,6 @@ @php -$links = Hyde\Framework\Actions\GeneratesNavigationMenu::getNavigationLinks($currentPage); -$homeRoute = ($links[array_search('Home', array_column($links, 'title'))])['route'] ?? Hyde::pageLink('index.html'); +$navigation = \Hyde\Framework\Modules\Navigation\NavigationMenu::create($page->getRoute()); +$homeRoute = $navigation->homeRoute->getLink($currentPage); @endphp