Post Yet another static site generator.

Recently I decided to rebuild my website from scratch. What I had before ( and still have now ) is a collection of static HTML files sitting on my server, being served up with no preprocessing involved. Simple. This simple system has many drawbacks as I'm sure anyone who has ever managed a website is well aware of. The popularity of Wordpress and Tumblr speaks to this as it can be a huge hassel to manage content on a website as simple as mine. In the past I had relied upon simple bash scripts to handle rudimentary templating, but I would soon hit their limits as a site became more complex. So, judging from the proliferation of static site generators, I figured I could make my own.

While this isn't as fulll featured or heavily vetted as similar solutions ( Jekyll, Hyde, Punch, etc... ), it fits my needs well and was a good weekend project for me.

Features:

  • Boilerplate generation
  • Support for mutiple markup languages ( HTML, Markdown, reStructured )
  • Support for multiple templating languages ( Jinja2, Handlebars )
  • Support for plugins
  • SASS support
  • Syntax Highlighting ( via pygments )
  • "Live reload"
  • Automatic deployment
  • Highly configurable
  • Easy!

How to "Post" :

Posting is really easy.

danemason ~/mysite : post init

Voila!

You now have a functioning website at ~/mysite.

Composing an entry is simple as well:

danemason ~/mysite : post compose pagename.md

This will open your default editor with the file pagename.md waiting to be edited. The file will be located in mysite/posts by default, but this can be changed very easily as well. Lets say I want to have my posts located in a folder called entries:

danemason ~/mysite : post config posts_dir entries

Simple as that.

In fact, you can edit the config completely from the command line in this way. This comes in handy when testing templates, or whatever else.

What's in the config anyway? Well, you can look at the entire configuration file by going to mysite/.post/config.json, or by simply typing:

danemason ~/mysite : post config

Like the compose command, this will open the configuration file in your default text editor.

Since we are writing our pages in Markdown, our posts will need to be compiled to HTML before we can look at them in a browser, right? This is also very easy to do:

danemason ~/mysite : post build

This command will take all of your entries located in your post folder and turn them into HTML files and place them in your destination path ( by default mysite/html ).

This is a good way to rebuild your site for small changes, but entering post build after each edit can get tedious while developing. That is why Post will, as will so many other solutions available, automatically rebuild your pages after a change is made to them.

By entering:

danemason ~/mysite : post watch

You are telling Post to continously watch mysite and update the HTML files when a change is made. If you are a fan of SASS ( why wouldn't you be? ), you can tell Post to automatically recompile your stylesheets as well:

danemason ~/mysite : post watch --sass

That's all!

That's pretty much the gist of it. I will continue to develop this as my needs change, or in the unlikely event that anyone likes my stab at the whole static site generator thing more than hundreds of others previously made. In the off chance that you do, you can take a peek at the repository.

Get Posting