Display element on blog list page and not blog page?

I am new to Grav (a few weeks of playing around with theming, reading docs), and I am still getting my head around a few things (including Twig)

In a sandbox site, I am exploring aspects of theming (a custom theme with inheritance from antimatter). One thing I am currently stuck on is how to display an element on a blog list page and not the individual blog page. I have yet to determine which variable I could use for this when editing a custom blog_item.html.twig template.

For context, I developed a number of Drupal themes over several years, and the approach I would take there was content-type based (equivalent to page v post in Wordpress) variables.

Any suggestions would be appreciated. As would links to any further guides/tutorials beyond the grave documentation.

what sort of element? is it something you could set in the page frontmatter, then in the listing page, simply see if that value is set, and if so, display it?

thanks @rhuk. Appreciate the reply.

I worked it out a couple hours ago — seem I missed a typo in my template, which led to my confusion.

I have now used

{% if truncate %}

and

{$ else %}

to achieve what I was seeking to

I actually have the same question. Could you explain how you use them? For example I don’t want the tags on the blog listing page, but they should show with the post itself.

hi @Eli

in Antimatter theme you can remove tags from blog listing here
in partials/blog_item.html.twig

But it will remove from blog listing and blog single.

So one way to suit your needs (if i undersand well)
is to copy blog_item.html.twig rename to blog_item_single.html.twig but don’t remove L26-L32

last thing it’s to call the correct twig template when your are on your single post, to do so go to /templates/item.html.twig

change
{% include 'partials/blog_item.html.twig' with {'blog':page.parent, 'truncate':false} %}
to
{% include 'partials/blog_item_single.html.twig' with {'blog':page.parent, 'truncate':false} %}

The best way is to use theme inheritance to do your changes without modify original theme

Hope that helps

Dimitri