Fix issue with main rendering after layouts

I went back and forth as to whether the main template should render
during the layout or before the layout, but it's clear now that it
should render before the layout. This also allow for both a layout and
view that both use extends.