theNewDynamic / gohugo-theme-ananke

Ananke: A theme for Hugo Sites
https://gohugo-ananke-theme-demo.netlify.com/
MIT License
1.13k stars 1.14k forks source link

Featured image in post tile #518

Open metbril opened 2 years ago

metbril commented 2 years ago

In the posts view, each post is shown in a tile, three columns wide. Posts with a featured image show without image. It would be nice if the tile also shows that featured image.

LITUATUI commented 2 years ago

I also want the same.

mettaisgood commented 2 years ago

I can get that to work if I have it in the root of the posts. However, if I have it in its own directory, it does not show any image in the post tiles.
If I move a post into the root, the picture shows up in the post tile preview. I put it back in a sub directory (for its category) it has no picture. Is there a way to make this work for subdirs?

bksubhuti commented 2 years ago

First, the Ananke theme expects that your “posts” will be in content/post/ (singular) not content/posts/ (plural).

Second, to render featured images when viewing “post” list pages (regardless of depth):

mkdir -p layouts/post cp themes/ananke/layouts/post/list.html layouts/post/list.html Then edit layouts/post/list.html. Change this:

{{ .Render "summary" }} to this:

{{ .Render "summary-with-image" }}

I have confirmed this works. Issue should be close. Answer from https://discourse.gohugo.io/t/looking-for-theme-that-does-posts-previews-with-thumbnails-on-subdirectories/38472

I think the sample or directions should show this. I cannot tell you how long I have been searching for a theme that will do this out of the box.

metbril commented 2 years ago

Ananke does this partially but not specifically in this situation. Don't close my issue because you think it should be. Unless you are the repo owner of course.

bksubhuti commented 2 years ago

You should adjust your original complaint or make a new one.

regisphilibert commented 2 years ago

Thanks guys! We'll review this later this week. Don't worry @metbril we don't close issues unless resolved by code fix or conversation.

acgetchell commented 2 years ago

Tried this, unfortunately it doesn't work.

It used to be that in config.toml you could set featured_image to the path of the image you wanted and get the hero image for the site.

Pathsis commented 1 year ago

I don't really like this feature. If it's added in the future, I'd like to have the option to keep it as is!

iandstanley commented 1 year ago

cp themes/ananke/layouts/post/list.html layouts/post/list.html

doesn't work for me either

any other ideas would be appreciated