Body HTML Feature (persistent)

I found a workaround for development (using jQuery). Keep in mind that this is for development only. Once I finish setting up a site I transfer the content manually to the index.html and have it static for crawlers. Put the following into your headHTML:

<!-- jQuery -->
<script src="http://code.jquery.com/jquery-1.11.3.min.js"></script>
	
<!-- body content for development -->	
<script>	
$(function(){$('body').append(function(){/*!

	<div style="position:absolute; left:0px; top:0px; z-index:1000;">Hello World</div>
	<p>Put your HTML here</p>

*/}.toString().replace(/^[^\/]+\/\*!?/,'').replace(/\*\/[^\/]+$/,''))});
</script>

The method has the following benefits:

  • Custom body content is accessible from within Hype 3 development and previews (allows using the convenient preview button).
  • Content is not polluted with JS string concatenation (multi-line var definitions are only possible in ES6)
  • Easily transfers when finally publishing your site/work

Based on:

1 Like