The Layout of this Blog

Posted 2012-02-12 in pelican

20120212 Screenshot Template

In the time when this blog was still based on wordpress the whole minimalist thing was the total rage. So I went out to get a fine minimalistic theme for my blog. The one thing missing from the one I've found was a sidebar, so after a bit of searching I found a fork of the mnmlist with sidebars and comments, just the way I wanted it.

As far as I recall I went in to restrict the maximum page width, but that was about all the changes I made.

Now I had mnmlist theme and a "mnml blg" without posts...

Wordpress Theme to Jinja2 Templates

Anyway, when I found Pelican and decided that I would give it a try, I converted the old theme over into jinja2 templates, so that I could continue using it.

Actually the transition was really straight forward painless. I went through the .php files of the old theme, took one of the example templates as reference and copied most of the code over replacing the php with Jinja blocks.

As an example: this is the template that generates the individual html files for every post:

{% extends "base.html" %}
{% block title %}{{ SITENAME }} - {{article.title}}{% endblock title %}
{% block content %}
    <h1>{{article.title}}</h1>
    <div class="info">
        <p>
            {{article.locale_date}}
        </p>
    </div>
    <div class="entry">
        {{ article.content }}
    </div>
{% endblock %}

You get the idea. One just has to make sure that the css classes end up in the right spot.

The Jinja2 documentation and the documentation of Pelican are a good reference as well as the collection of pelican themes on github

You can find this theme on github, feel free to use and customize it any way you'd like.

comments powered by Disqus