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

Creating blog overview page - just images and titles

Started by Muut Archive 10 years ago · 2 replies · 371 views
10 years ago

Sorry if this is a duplicate - I may have deleted my last post (its very late here).

I'm trying to create a blog list / overview page containing just the titles of each blog post along with a thumbnail of the header image.

The code below will give me the entire post (image, body text & title), but i'd rather just have the image and title separately. Any suggestions are appreciated.

TWIG
            {% for child in collection %}

                {% include 'partials/blog_item.html.twig' with {'blog':page, 'page':child, 'truncate':true} %}
            {% endfor %}
10 years ago

you will need to create/modify/override the partial that you use. The blog_item.html.twig displays a summary with title/content. You could simply create a blog_miniview.html.twig or something, and use a modified version of the blog_item code to just display an image.

10 years ago

Thanks - though just to clarify, there's no way to access the image in the same fashion that I would get the url with {{child.url}} or the title with {{child.title}} in a {{for child in collection}} loop? I'm very new to Grav but that method feels logical to me.

Suggested topics

Topic Participants Replies Views Activity
Archive · by Deleted User, 9 years ago
0 1359 9 years ago
Archive · by Muut Archive, 9 years ago
2 936 9 years ago
Archive · by Muut Archive, 9 years ago
2 4066 9 years ago
Archive · by Muut Archive, 9 years ago
1 2955 9 years ago
Archive · by Muut Archive, 9 years ago
3 1121 9 years ago