Lannister is a static website generator. It is a work in progress.
- Uses Go's standard library for templating. Yay!
- Multiplexes output. What? It means you can define multiple output templates for a piece of content.
- Multiplexes input. What? Means you can mix in other content together. See the tutorial section.
- Settings are stored in an SQLite database. Don't worry about this, it's just convenient and means you can do more with them.
Sorry. This is Go code, so it's not simple or straightforward to distrubute code. At least, I've not heard of any easy way.
- Install Go, if you haven't already. It involves setting some stupid environment variables unlike any other language, which is lame, but what can you do? -> http://golang.org/doc/install.html
- Then run
- Or (probably more sensible), clone this repository and type
- You now have a binary, called lannister, that you can copy or link somewhere in your $PATH. I'd recommend ~/bin but that's just me.
- Once again, I am truly sorry about that whole installation thing. One day we will look back and laugh about it. Probably.
This tutorial is aimed at exactly what I wrote this tool for. I wanted a static site, with content loaded using the awesome PJAX jQuery plugin https://github.com/defunkt/jquery-pjax. PJAX requires, like any AJAX-based tech, that the content requested is returned without the entire page. This means, if you want to serve up /about.html both as a static file (fully templated) and as a page fragment (for PJAX), you need different layouts/formats/whatever. This, in a nutshell, is the problem Lannister has arrived to solve.
So let's get on with creating a website. It's pretty exciting doing this, every single time and this time is no exception.
./lannister createsite ~/Dropbox/Sites/newsite
See what I did there? Dropbox is cool, you have to admit. Anyway, whether or not you're cool with syncing your new website on every computer you own (seriously, who wouldn't want that?), let's examine what we have got.
In the new directory that was created, we have the following:
OK, that seems reasonable. You will notice from the above that the conventions for using Lannister are for using Markdown for the content.
So now let's generate the site:
That will spit the entire site in the site/ sub-directory.
So what does it do? Well, this bootstrapped site provides a really simple site that shows how you can use PJAX to make cool websites with static content. Put it behind Varnish to cache things and speed up your site even more (saving you some hosting costs when you write that super amazing article - or rant - and get slashdotted).
Now if you want to test the site in your browser, run:
This will serve the content of your site on localhost:6565 - check it out!
You will need another loopback address:
sudo ifconfig lo0 alias 127.0.0.2 up
Yeah, alternatives. Makes it sound like this is the default. Yeah so you could use one of those other wacky systems, but you don't want to do that. Still, there are other systems out there. No doubt you've heard of at least two of these.
- Jekyl. github use this for pages and blogs. I use it for my blog. Yeah. I use it. What an admission.
- Hyde. As soon as somebody created a project called 'Jekyl', somebody just had to create one called 'Hyde'. Full marks there!
- Bloxsom. Oh yeah! You remember that thing, the one in Perl, right? Yeah. Still exists. Doesn't really do much useful to me. Very blog-focused. Baroque.
- Hakyll in Haskell
- utternson in Clojure
- Ensemble I have no idea what this is
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.