Embedding Flattr into Hakyll

Posted on August 17, 2014
Tags: hakyll

First add the HTML element for the Flattr button to the end of your posts template

<div class="flattr">
<a class="FlattrButton"
   href="http://geekplace.eu/flow$url$" title="$title$" lang="en"
   data-flattr-uid="Flowdalic"
   data-flattr-tags="blog"
   data-flattr-category="text"
   data-flattr-button="compact"/>
</div>

Then add the Flatt Javascript in your HTML header, ie. within the head element, at templates/default.html:

<script type="text/javascript">
  /* <![CDATA[ */
(function() {
    var s = document.createElement('script');
    var t = document.getElementsByTagName('script')[0];

    s.type = 'text/javascript';
    s.async = true;
    s.src = '//api.flattr.com/js/0.6/load.js?mode=auto';

    t.parentNode.insertBefore(s, t);
 })();
/* ]]> */
</script>