--- author: '' category: '' date: 2013/01/01 19:03:43 description: '' link: '' priority: '' slug: client-rendered-one-url-dynamic-static-site tags: nikola, python title: Client-rendered, one-URL, dynamic, static site. type: text updated: 2013/01/01 19:03:43 url_type: '' --- 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: 1. Renders post data as JSON files instead of HTML 2. Creates a HTML file that is really a `mustache.js template `_ 3. Creates a HTML file with some bits of Javascript that loads the template and the newest post's data. 4. 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!