Skip to content
Grav 2.0 is officially stable. Read the announcement →

Community guidelines

Please keep discussions civil and on-topic. Repeated violations may lead to a temporary ban.

Plugins

Sort attached images at blog posts for choosing a teaser picture thru admin plugin

Started by Joachim Kasper 9 years ago · 1 replies · 539 views
9 years ago

I have a blog node, with an attached image. this setting i use to show for the teaser listing.

when i add another one the latest uploaded image will be shown in the listing.

i like to choose which image will be used for the teaser.

maybe there is a plugin for my issue?

9 years ago

you probably just need to set something in the page header like:

TXT
featured_image: foo.jpg

Then in your Twig template for the blog display you could have:

TWIG
<div id="featured-image">
{{ page.media[page.header.featured_image].html() }}
</div>

{{ page.content() }}

This way you are pulling out the image you have selected as featured rather than just using the |first or whatever.

Suggested topics

Topic Participants Replies Views Activity
Plugins · by Rene, 1 week ago
2 47 1 week ago
Plugins · by Xavier, 4 weeks ago
2 56 4 weeks ago
Plugins · by Luka Prinčič, 7 years ago
3 1182 1 month ago
Plugins · by Sebastian van de Meer, 1 month ago
1 50 1 month ago
Plugins · by PIERROT Alain, 2 months ago
3 74 2 months ago