HubPress / hubpress.io

A web application to build your blog on GitHub
MIT License
2.81k stars 2.63k forks source link

How to automatically add some javascript to generated html file? #361

Open yokas opened 8 years ago

yokas commented 8 years ago

I would like to add some js file into the generated post html, is it possible?

jaredmorgs commented 8 years ago

Not sure that it is. You could try putting an AsciiDoc pass through block in the post body, but I think HubPress sets Asciidoctor.js to safe mode, which may make any JavaScript non executable when built. Thoughts, @anthonny ?

rorosaurus commented 8 years ago

Is there a specific reason we use safe mode?

wols commented 8 years ago

Passthrough block works fine - I use it for include Javascript tracker code:

++++
<!-- Piwik -->
<script type="text/javascript">
  // code here
</script>
<noscript><p><!-- a image --></p></noscript>
<!-- End Piwik Code -->
++++

See _posts in my repo 'time'...