Skip to content
Grav 2.1 is out: every page speaks Markdown. Read the announcement →

Variable to determine list view or page detail view

Started by Muut Archive 11 years ago · 1 replies · 279 views
11 years ago

Is there a way in Grav/Twig to know you're looking at a blog post in a list. (In order to show different content in teaser than in detail page - eg. show pictures/media only on detail page, not on list page)

11 years ago

Well you have a few options. You can use a different twig template to render the item in the list and on it's own. Then in each template you can render things differently, or add a css class or something, to display things differently via css alone.

You could pass a variable into the twig include that tells the template if it's a list or a detailed view.

Alternatively you could have a header setting on the page with a 'summary or headline' or something that you use on the list view, then simply show the full content on the details view.

Suggested topics

Topic Participants Replies Views Activity
Archive · by Deleted User, 9 years ago
0 2280 9 years ago
Archive · by Muut Archive, 9 years ago
2 1496 9 years ago
Archive · by Muut Archive, 9 years ago
2 4745 9 years ago
Archive · by Muut Archive, 9 years ago
1 3559 9 years ago
Archive · by Muut Archive, 9 years ago
3 1621 9 years ago