Linked List Posts in Pelican

August 08, 2012 by Gabe | [mmd] |

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.

<h1>
    {% if article.link %}
        <a href="{{ article.link }}"
        rel="bookmark"
        title="External Link"
        >{{ article.title }}</a>
    {% else %}
        <a href="{{ SITEURL }}/{{ article.url }}"
        rel="bookmark"
        title="Permalink to {{ article.title}}"
        >{{ article.title }}</a>
    {% endif %}
</h1>

For this to work my Markdown header looks like this:

title: Awesome Post
tags: blogging about blogging
link: http://www.macdrifter.com/2012/01/post-to-wordpress-from-simplenote-or-dropbox.html

The "{{article.link}}" 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. 

blog comments powered by Disqus