Pelican - add image to summary

Viewed 1853

I'm using pelican to create a website. I'm trying to add an image to the summary so that the summary always starts with an image.

I tried adding the image to the summary in the metadata (using markdown) but it only shows up on the index page and not on the other pages (in the example below the image does not show in the Posts page). I also have to add the image in the same line as the text which sometimes renders in a weird way (some text is to the side of the image depending on the image size).

Here is an example of the metadata:

Title: this is my title
Slug: slug
Date: 2017-05-04 23:00
Category: Posts
Tags: pelican
Author: Eyal
Summary: ![figure 1](images/fig1.png) and this is my post summary

I also tried to use the summary plugin but that but that did not work at all.

What is the easiest way to add an image to the summary? I was hoping to avoid modifying the html code if possible.

3 Answers

For those using the AboutWilson template in Pelican I have managed to make it work as well by adding the following code in the index.html file (in the template folder)

{% if article.cover %}
Cover:
<span> 
    <img src="{{ article.cover }}" alt=""> 
</span>
{% endif %}

enter image description here

Related