Fix regression in HTML markup

Head items need to be added BEFORE the template is generated
Introduced by  I43fc26bf334753b189e20921f142bade7658ac31
Bug: 57257

Change-Id: I111a1784b8e6b84747e598c2f71e48c5440297be
Merge "Fix regression in HTML markup"