Heads up! To view this whole video, sign in with your Courses account or enroll in your free 7-day trial. Sign In Enroll
Start a free Courses trial
to watch this video
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.
You need to sign up for Treehouse in order to download course files.
Sign up