user3088077
user3088077

Reputation: 283

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

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/

Upvotes: 3

Views: 1968

Answers (3)

BiscuitEdi
BiscuitEdi

Reputation: 71

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

Upvotes: 0

Reedyn
Reedyn

Reputation: 321

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}}">

Upvotes: 2

roshiro
roshiro

Reputation: 780

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.

Upvotes: 1

Related Questions