timber / starter-theme

The "_s" for Timber: a dead-simple theme that you can build anything from
MIT License
820 stars 278 forks source link

Flexible page.php #14

Closed geibi closed 8 years ago

geibi commented 8 years ago

Wouldn't it be better to replace line 27 in page.php

Timber::render( array('page.twig' ), $context );

with

Timber::render( array( 'page-'.$post->slug.'.twig', 'page.twig' ), $context );

So you got only one page.php but multiple page-home.twig page-contact.twig aso would be possible? Additionally you are also free to duplicate page.php to e.g. page-about.php if you need to modify some other processing.

Or is there any downside?

jarednova commented 8 years ago

@geibi I believe that's what is in there now, check out:

https://github.com/Upstatement/timber-starter-theme/blob/master/page.php#L27

... are you sure you're looking at master?

geibi commented 8 years ago

ouuuuhhhhhhh! sorry jarednova. i think something went wrong on my side, because it was like i posted above. brillant, that's how it should be :)