Layouts5:12 with Jay McGavren
Our site has many different ERB templates, each containing HTML code that should go in the middle of a document. But the code at the start and end of each page will always be the same. It would be a shame to have to replicate the same HTML head elements and CSS stylesheet link across every ERB template file in our app. That's why Sinatra offers a better way. We can move the shared outer wrapper code to a single ERB file, called a layout. Then we can embed any of the templates we need within the layout. We get the same wrapper code on every page of our site, but we only need one copy of the code.
This video doesn't have any notes.
You need to sign up for Treehouse in order to download course files.Sign up