Linked List Posts in Pelican

I will eventually write up the ever so exciting story of building a Pelican static blog site, but until then, here’s a trick that required a visit to the Pelican IRC channel.1

Pelican provides access to any user defined Markdown meta data field. That means I can define a “link:” field to create a DF-style linked post title automatically. Here’s the bit of Jinja code that is in my “Article” and “index” templates.

:::css+django, css+jinja
	{% if %}
        <a href="{{ }}"
        title="External Link"
        >{{ article.title }}</a>
	{% else %}
        <a href="{{ SITEURL }}/{{ article.url }}"
        title="Permalink to {{ article.title}}"
        >{{ article.title }}</a>
	{% endif %}

For this to work my Markdown header looks like this:

title: Awesome Post
tags: blogging about blogging

The “{{}}” token inserts the meta data found for the MD header element “link”.

I’m still trying to understand how to create RSS feed link-style articles.

  1. You remember IRC, right? It’s Twitter from the 80’s. ↩︎