pelican jinja

Pelican oddities

Marcelino Veloso III,

Do single brackets work?

Per 4.8.0, Pelican features built-in single bracket variables like {tag}, {static}:

You can link to authors, categories, index and tags using the {author}name, {category}foobar, {index} and {tag}tagname syntax.

When used in html

Based on the above, it seems to instruct that the single bracketed built-ins would work in tandem with the double bracketed variables that Jinja (a Pelican dependency) employs:

{% for tagname in article.tags %}
  <a href="{tag}{{tagname}}">{{tagname}}</a>http://127.0.0.1:8000/tagmarkdown
{% endfor %} {# note single / double brackets #}

The output html for {tag} though results in a malformed url, e.g. <a href="%7Btag%7Dpelican-tag">pelican-tag</a>.

To remedy, using the more manual process gets the job done:

{% for tagname in article.tags %}
  <a href="{{ SITEURL }}/{{ tagname.url }}">{{tagname}}</a>
{% endfor %}

When used in markdown

Interestingly, when used in markdown files, the {filename} built-in described under Linking to internal content works.