Pelican Static Site Generator
I'm using Pelican to build this site. It's pretty great and I'd like to share the config that I am using for it.
My pelicanconf.py config file is hosted as a gist.
Pelican comes with some great defaults, I have not had to make many changes. Most changes are for how the markdown posts are renamed when generated to html.
ARTICLE_URL = 'posts/{date:%Y}/{slug}.html'
ARTICLE_SAVE_AS = 'posts/{date:%Y}/{slug}.html'
ARCHIVES_SAVE_AS = 'posts/index.html'
YEAR_ARCHIVE_SAVE_AS = 'posts/{date:%Y}/index.html'
ARCHIVES_URL = "posts/index.html"
With the above config, a post I made on July 17, 2013 with a title of "first post" will be saved to /posts/2013/first-post.html and it will have the same URL. The yearly archive is /posts/2013/index.html. This is nice because when reading the article anyone can just delete the post title from the URL and get the archive for the year. I do not write enough to worry about breaking the yearly archive into monthly archives.
The template that I use, pelican-bootstrap3, defaults the archive URL to archive.html
, so I have to override it with the ARCHIVES_URL
variable.
It's interesting to me that I have to config both the URL and the SAVE_AS path for an article. On a static site these will always be the same thing. Whats the advantage to configuring these separately?
A great thing about the pelican-bootstrap3 theme is that it comes with many
sub-themes that can be toggled with the BOOTSTRAP_THEME
variable.
I've really enjoyed using pelican to generate this site. If I had to maintain another site I would definitely start with pelican and see if I could get away with using it. A static site is a great way to publish information and can be very cheaply hosted on S3.
Comments
comments powered by Disqus