Fixing Nikola Footnote Locations

Personally, I prefer to intersperse my footnote declarations with the text that is being footnoted when writing my. For example:[1]

[1] This is just an example.
I might want to write something[#]_ where there's a footnote there.

.. [#] I put the footnote definition here.

And then I continue on with the rest of my writing.

Wherever they are declared, I prefer to have all of my footnotes appear at the end of my posts. By default, Nikola puts the footnotes in wherever they are declared. A simple snippet of javascript can be used to fix the locations of footnotes:

$(document).ready(function() {
    $('.footnote').each(function(i, el) {
        $(el).appendTo(
            $(el).closest('article'));
    });
});

Simply wrap in a <script> tag and include in the BODY_END section of conf.py