File tree Expand file tree Collapse file tree 5 files changed +22
-4
lines changed
Expand file tree Collapse file tree 5 files changed +22
-4
lines changed Original file line number Diff line number Diff line change @@ -131,7 +131,7 @@ private function searchForLabelInConfig(): ?string
131131 {
132132 return Arr::get (config ('hyde.navigation.labels ' , [
133133 'index ' => 'Home ' ,
134- ' docs/index ' => 'Docs ' ,
134+ DocumentationPage:: homeRouteName () => 'Docs ' ,
135135 ]), $ this ->routeKey );
136136 }
137137
Original file line number Diff line number Diff line change @@ -46,6 +46,6 @@ public function getItemsInGroup(?string $group): Collection
4646
4747 protected static function shouldItemBeHidden (NavItem $ item ): bool
4848 {
49- return parent ::shouldItemBeHidden ($ item ) || $ item ->getRoute ()?->is(' docs/index ' );
49+ return parent ::shouldItemBeHidden ($ item ) || $ item ->getRoute ()?->is(DocumentationPage:: homeRouteName () );
5050 }
5151}
Original file line number Diff line number Diff line change @@ -81,6 +81,6 @@ protected static function dropdownsEnabled(): bool
8181 protected static function shouldItemBeHidden (NavItem $ item ): bool
8282 {
8383 return parent ::shouldItemBeHidden ($ item ) ||
84- $ item ->getRoute ()?->getPage() instanceof DocumentationPage && ! $ item ->getRoute ()->is (' docs/index ' );
84+ $ item ->getRoute ()?->getPage() instanceof DocumentationPage && ! $ item ->getRoute ()->is (DocumentationPage:: homeRouteName () );
8585 }
8686}
Original file line number Diff line number Diff line change @@ -26,7 +26,12 @@ class DocumentationPage extends BaseMarkdownPage
2626
2727 public static function home (): ?Route
2828 {
29- return Route::get (static ::$ outputDirectory .'/index ' );
29+ return Route::get (static ::homeRouteName ());
30+ }
31+
32+ public static function homeRouteName (): string
33+ {
34+ return static ::baseRouteKey ().'/index ' ;
3035 }
3136
3237 /** @see https://hydephp.com/docs/master/documentation-pages#automatic-edit-page-button */
Original file line number Diff line number Diff line change @@ -144,6 +144,19 @@ public function test_home_method_finds_docs_index_for_custom_nested_output_direc
144144 File::deleteDirectory (Hyde::path ('foo ' ));
145145 }
146146
147+ public function test_home_route_name_method_returns_output_directory_slash_index ()
148+ {
149+ $ this ->assertSame ('docs/index ' , DocumentationPage::homeRouteName ());
150+ }
151+
152+ public function test_home_route_name_method_returns_customized_output_directory_slash_index ()
153+ {
154+ config (['docs.output_directory ' => 'foo/bar ' ]);
155+ (new HydeServiceProvider ($ this ->app ))->register ();
156+
157+ $ this ->assertSame ('foo/bar/index ' , DocumentationPage::homeRouteName ());
158+ }
159+
147160 public function test_has_table_of_contents ()
148161 {
149162 $ this ->assertIsBool (DocumentationPage::hasTableOfContents ());
You can’t perform that action at this time.
0 commit comments