File tree Expand file tree Collapse file tree 5 files changed +9
-6
lines changed
Resources/templates/content Expand file tree Collapse file tree 5 files changed +9
-6
lines changed Original file line number Diff line number Diff line change @@ -70,8 +70,11 @@ public function getIndexPage(): string
7070 $ indexPage = null ;
7171
7272 if ($ this ->siteConfig ->site_index !== null ) {
73+ $ pageTpl = $ this ->siteConfig ->site_index_tpl ?? 'content/single.html.twig ' ;
7374 $ page = $ this ->contentProvider ->fetch ($ this ->siteConfig ->site_index );
74- $ indexPage = $ this ->getSinglePage ($ page );
75+ $ indexPage = $ this ->twigServiceProvider ->render ($ pageTpl , [
76+ 'content ' => $ page ,
77+ ]);
7578 }
7679
7780 if ($ indexPage === null ) {
Original file line number Diff line number Diff line change 88test ('command "build" calls methods from StaticBuilder ' , function () {
99 $ app = getLibrarian ();
1010 $ app ->runCommand (['minicli ' , 'build ' ]);
11- })->expectOutputRegex ("/Finished building static website/ " );
11+ })->expectOutputRegex ("/Finished building static website/ " );
Original file line number Diff line number Diff line change @@ -90,6 +90,7 @@ function getCustomIndexPageApp(): App
9090{
9191 $ config = getDefaultAppConfig ();
9292 $ config ['site_index ' ] = 'posts/test0 ' ;
93+ $ config ['site_index_tpl ' ] = 'content/index.html.twig ' ;
9394
9495 $ app = new App ($ config );
9596 $ app ->addService ('builder ' , new StaticBuilder ());
@@ -100,4 +101,3 @@ function getCustomIndexPageApp(): App
100101
101102 return $ app ;
102103}
103-
Original file line number Diff line number Diff line change 1+ template index
Original file line number Diff line number Diff line change 66use Librarian \Provider \TwigServiceProvider ;
77use Minicli \App ;
88
9- beforeEach (function () {
9+ beforeEach (function () {
1010 $ app = new App (getDefaultAppConfig ());
1111 $ app ->addService ('builder ' , new StaticBuilder ());
1212 $ app ->addService ('twig ' , new TwigServiceProvider ());
4646 expect (is_file ($ app ->builder ->outputPath . '/index.html ' ))->toBeTrue ();
4747
4848 $ content = file_get_contents ($ app ->builder ->outputPath . '/index.html ' );
49- expect ($ content )->toMatch ("/template single / " );
49+ expect ($ content )->toMatch ("/template index / " );
5050});
5151
5252test ('StaticBuilder builds paginated tag pages ' , function () {
7070 $ builder ->cleanUp ();
7171 expect (is_file ($ builder ->outputPath . '/index.html ' ))->toBeFalse ();
7272});
73-
You can’t perform that action at this time.
0 commit comments