File tree Expand file tree Collapse file tree 2 files changed +14
-3
lines changed
Expand file tree Collapse file tree 2 files changed +14
-3
lines changed Original file line number Diff line number Diff line change 77use Hyde \Foundation \HydeKernel ;
88use Hyde \Framework \Exceptions \BaseUrlNotSetException ;
99use Hyde \Framework \Exceptions \FileNotFoundException ;
10- use Hyde \Pages \DocumentationPage ;
1110use Illuminate \Support \Str ;
1211
1312/**
@@ -39,8 +38,8 @@ public function formatLink(string $destination): string
3938 return '/ ' ;
4039 }
4140
42- if ($ destination === DocumentationPage:: outputDirectory (). ' / index.html ' ) {
43- return DocumentationPage:: outputDirectory (). ' / ' ;
41+ if (str_ends_with ( $ destination, ' index.html ') ) {
42+ return substr ( $ destination , 0 , - 10 ) ;
4443 }
4544
4645 return substr ($ destination , 0 , -5 );
Original file line number Diff line number Diff line change @@ -98,4 +98,16 @@ public function test_helper_does_not_rewrite_documentation_page_index_when_not_u
9898 self ::mockConfig (['hyde.pretty_urls ' => false ]);
9999 $ this ->assertEquals ('docs/index.html ' , Hyde::formatLink ('docs/index.html ' ));
100100 }
101+
102+ public function test_helpers_rewrites_arbitrary_nested_index_pages_when_using_pretty_urls ()
103+ {
104+ self ::mockConfig (['hyde.pretty_urls ' => true ]);
105+ $ this ->assertEquals ('foo/bar/ ' , Hyde::formatLink ('foo/bar/index.html ' ));
106+ }
107+
108+ public function test_helpers_does_not_rewrite_arbitrary_nested_index_pages_when_not_using_pretty_urls ()
109+ {
110+ self ::mockConfig (['hyde.pretty_urls ' => false ]);
111+ $ this ->assertEquals ('foo/bar/index.html ' , Hyde::formatLink ('foo/bar/index.html ' ));
112+ }
101113}
You can’t perform that action at this time.
0 commit comments