A look at static site generators
Motivation
In my search for a Joomla replacement I have decided that I want to try a static site generator. Static site generator is a software that takes some text + templates as input and produces html files on the output.
What I want
I want it to be written in Python, have reasonable documentation and a live community. It should also be actively developed. After applying all this parameters I was left with Hyde and Pelican. I was experimenting a bit with Hyde, but some of the dependencies it needed is not present in the conda packagecollection so I moved on to the second alternative.
Install pelican
$ conda create -n pelican python
$ conda install pelican
$ conda install markdown
$ conda install typogrify
$ source activate pelican
Make your first site
$ mkdir site.tld
$ cd site.tld
$ pelican-quickstart
You will now have the following files
.
./content
./develop_server.sh
./Makefile
./output
./pelicanconf.py
./publishconf.py
Create some content, lets start with an article
$ vi content/post1.md
Try use the following example code
Title: A post
Date: 2015-01-01 10:00
Category: Blog
Tags: information, public
A post/article on my site.tld, blabla.
Generate your site
$ pelican content
Prewiev your site
$ cd output
$ python -m SimpleHTTPServer
open your browser and go to 127.0.0.1:8000 ad congratulation!
Create more pages, lets try create a page
$ cd ..
$ mkdir content/pages
$ vi content/pages/about.md
Try use the following example code
Title: About
Date: 2015-01-01 11:00
Category: Info
Tags: information, public
About site.tld, blabla.
Regenarate the site (learning a better way to do it)
$ make clean
$ make regenerate
Deployment
The content in your output folder is now static html and can be served from your webserver of choice. Just get the server up and running and drop the content of the output folder into the servers docroot.
Learn more
- Pelican's documentation is pretty easy: http://docs.getpelican.com/en/3.5.0/content.html
- Some tutorials related to deployment: https://github.com/getpelican/pelican/wiki/Tutorials
- A short introduction to Markdown: https://help.github.com/articles/markdown-basics/
Errata
Be aware that the version in conda is not the newest one. There is some functionality in the most current version that is worth checking out. If you use pip as your packagemanager this is not an issue since pip has the latest version of Pelican and needed dependencies.