Skip to content
● Grav 2.2 is out: 2x faster cold starts and 96% less memory on big sites. Read the announcement →

Exclude header image from getting displayed by the «simple gallery» cookbook

Started by Muut Archive 10 years ago · 0 replies · 531 views
10 years ago

Hello everyone,

I'm planning to apply the «simple gallery» cookbook for a Grav powered portfolio site. Is there any way I could exclude a single image (the header image) from getting rendered?

My current workaround is by putting each of the gallery's header image inside their own respective subfolder called _img and displaying them through hardcoded <img> tag in the Twig template.

I'm just wondering if there is another efficient way to do this. 😄

By the way, here is how I hardcoded the header image:

TWIG
{% if header_image %}
    <div>
        {% set the_the_the_current_folder = page.filePathClean|rtrim('md') %}
        {% set the_the_current_folder = the_the_the_current_folder|rtrim('.') %}
        {% set the_current_folder = the_the_current_folder|rtrim(page.template) %}
        <img src="{{ base_url_absolute }}/{{ the_current_folder }}/_img/header.jpg">
    </div>
{% endif %}

Bear with me, I'm no programmer. 😄

👍 1

Suggested topics

Topic Participants Replies Views Activity
Archive · by Deleted User, 9 years ago
0 2563 9 years ago
Archive · by Muut Archive, 9 years ago
2 1689 9 years ago
Archive · by Muut Archive, 9 years ago
2 4980 9 years ago
Archive · by Muut Archive, 9 years ago
1 3804 9 years ago
Archive · by Muut Archive, 9 years ago
3 1798 9 years ago