Move the custom layout section markup into template files (see #6531)