fix issue with prerendered content

Move scripts to end of body so that prerendered content is before them
in the page. This fixes issue where prerendered content was not being
removed from the document body in mobile browsers.