change the layout of the templates based on available content