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

Best way to hide "hero" image on detailed view?

Started by Muut Archive 10 years ago · 4 replies · 1312 views
10 years ago

On my blog, using Future theme, I like the way Grav is displaying a big picture on each post on the list post page, but when arriving on a detailed blog post I find it weird that almost the same image is displayed twice. Any advice on the best way to hide the "hero" version of the picture on the detailed view of the blog post?

Thanks!

10 years ago

Thanks. having a deeper look, I now see my misunderstanding. I was believing that the image was coming from page.content but in face it was above in the theme. If that can interest someone, I have changed in my templates/partials/blog_item.html.Twig file, around line 50 at the time of writing :

TWIG
{% if big_header %}
  {{ page.media.images|first.cropResize(1038,437).html(page.title, page.title, 'image featured') }}
{% else %}
  {{ page.media.images|first.cropZoom(1038,437).html(page.title, page.title, 'image featured') }}
{% endif %}

to :

TWIG
{% if not big_header %}
  {{ page.media.images|first.cropResize(1038,437).html(page.title, page.title, 'image featured') }}
{% endif %}

Maybe not the best solution but it works :)

10 years ago

Glad you solved your problem. It's wise to follow the instructions I linked to above and separate your changes into a new theme that inherits the old one. That way when the theme gets updated, you don't lose your changes.

Suggested topics

Topic Participants Replies Views Activity
Archive · by Deleted User, 9 years ago
0 1360 9 years ago
Archive · by Muut Archive, 9 years ago
2 938 9 years ago
Archive · by Muut Archive, 9 years ago
2 4068 9 years ago
Archive · by Muut Archive, 9 years ago
1 2958 9 years ago
Archive · by Muut Archive, 9 years ago
3 1122 9 years ago