How to add a post image in Ghost's index?

1.9k Views Asked by At

I don't see any examples in the docs on how to use a post's image on the index view of Ghost. For example, you can see this theme doing it: http://studio-lite-theme.ghostify.io/

Any ideas?

EDIT: If anyone comes across this, I found this post that helped: https://ghost.org/forum/themes/1401-tip-how-to-show-the-pic-of-your-post-in-index-hbs/

3

There are 3 best solutions below

0
On

As @user3088077 mentioned in his edit, I could make the image appear in the index page by replacing in the index.hbs

from {{ excerpt }} to {{content words="0"}}.

What happens is that excerpt does not include images, while content does.

0
On

Since version 0.5.2 there's now official support for Post Images. So avoid the hack using {{content words="0"}}

Instead use {{image}} to print out the url for the image.

For example: <header {{#if image}}" style="background-image: url({{image}}){{/if}}">

0
On

This is aimed towards displaying the featured image in index which means it needs to be on the front page not on post page.