Following @sfdcfox's comments I replaced <apex:stylesheet />
and <apex:includeScript />
with vanilla HTML tags. At least these resources moved back into the correct location inside the tags. However, SF still keeps outputting sections of scripts and stylesheets both before and after the body tags.
The current output stands at:
<!DOCTYPE HTML>
<head><script src="/static/111213/js/perf/stub.js" type="text/javascript"></script><script src="/faces/a4j/g/3_3_3.Finalorg.ajax4jsf.javascript.AjaxScript?rel=1597694166000" type="text/javascript"></script><script src="/static/111213/js/functions.js" type="text/javascript"></script><script src="/jslibrary/1595625414226/sfdc/main.js" type="text/javascript"></script><script src="/jslibrary/jslabels/1597696824000/en_US.js" type="text/javascript"></script><script src="/static/111213/desktop/desktopAjax.js" type="text/javascript"></script><script src="/static/111213/js/picklist4.js" type="text/javascript"></script><script src="/resource/1478908878000/jquery310min" type="text/javascript"></script><script src="/jslibrary/1586381828226/sfdc/VFState.js" type="text/javascript"></script><script src="/jslibrary/1589998732226/sfdc/NetworkTracking.js" type="text/javascript"></script><script>try{ NetworkTracking.init('/_ui/networks/tracking/NetworkTrackingServlet', 'network', '06641000001OIbR'); }catch(x){}try{ NetworkTracking.logPageView();}catch(x){}</script><script>(function(UITheme) {
UITheme.getUITheme = function() {
return UserContext.uiTheme;
};
}(window.UITheme = window.UITheme || {}));</script></head><span id="j_id0:j_id1"></span>
<html>
<head>
<meta HTTP-EQUIV="PRAGMA" CONTENT="NO-CACHE" />
<meta HTTP-EQUIV="Expires" content="Mon, 01 Jan 1990 12:00:00 GMT" />
<meta content="width=device-width, initial-scale=1.0" name="viewport" />
<link href="/resource/****16000/FontAwesome4/font-awesome-4.7.0/css/font-awesome.css" rel="stylesheet" />
<link href="/resource/****31000/Bootstrap4/bootstrap-4.5.2-dist/css/bootstrap.min.css" rel="stylesheet" />
<link href="/resource/****13000/AcadResources/InstApp.css" rel="stylesheet" />
....
........
</head>
<body>
...........
..............
<script src="/resource/****44000/jQuery3/jquery-3.5.1.slim.min.js"></script>
<script src="/resource/****58000/PopperJS2/popper.min.js"></script>
<script src="/resource/****31000/Bootstrap4/bootstrap-4.5.2-dist/js/bootstrap.min.js"></script>
</body>
</html><script type="text/javascript">Sfdc.onReady(function(){
SfdcApp && SfdcApp.Visualforce && SfdcApp.Visualforce.VSManager && SfdcApp.Visualforce.VSManager.vfPrepareForms(["j_id0:j_id9"]);
});</script>
Just can't figure out what's causing the output of the extra <head>
section BEFORE the <html>
tag and likewise the additional tags after </html>
.
Where am I going wrong?