My vacations end tomorrow. So, the time to spend hacking fun, personal, free stuff is going
to be limited because of the time spent coding fun, free stuff for money. So, I decided
to finish with a bit of whimsy.
I implemented a completely client-rendered, one-URL, dynamic blog. Which is actually
totally static.
In fact, that blog is this blog, just with a twist.
If you go to this URL you will see
what's basically this very site, with comments and everything as usual.
But if you click on "Previous Post" ... well, it stays in the same page, even though it
displays a different post :-)
The magic is the new, experimental, dynamic task_mustache plugin
for my static site generator, Nikola. which does the following:
Renders post data as JSON files instead of HTML
Creates a HTML file that is really a mustache.js template
Creates a HTML file with some bits of Javascript that loads the template and the newest
post's data.
If you access that mustache.html with a fragment, it uses that to fetch JSON data and rewrite
itself.
And that's it. It actually loads fast, and regenerates very fast, since it does much less
than the real site. There are a bunch of things that will dump you out of the "dynamic" site,
like tag links, and whatever, but it works surprisingly well (and if you want to theme it, it's
just one template).
This is the first of a new kind of thing for Nikola, the "extra plugins". Basically, stuff
that is too weird, specific or useless for the general distro, will go there, and to use those
plugins, you have to create a plugins/
folder in your site and add it there manually.
Enjoy!